zhanghang1989 / zhanghang1989/PyTorch-Encoding

ImportError: cannot import name 'cpu'

Open
#405 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
448
PR merge metrics
No merged PRs in 30d

Description

Traceback (most recent call last):
File "scripts/prepare_pascal.py", line 6, in
from encoding.utils import download, mkdir
File "/home/szy/PyTorch-Encoding/encoding/init.py", line 13, in
from . import nn, functions, parallel, utils, models, datasets, transforms
File "/home/szy/PyTorch-Encoding/encoding/nn/init.py", line 12, in
from .encoding import *
File "/home/szy/PyTorch-Encoding/encoding/nn/encoding.py", line 18, in
from ..functions import scaled_l2, aggregate, pairwise_cosine
File "/home/szy/PyTorch-Encoding/encoding/functions/init.py", line 2, in
from .encoding import *
File "/home/szy/PyTorch-Encoding/encoding/functions/encoding.py", line 15, in
from encoding import cpu
ImportError: cannot import name 'cpu'

When I run this command 'python scripts/prepare_ade20k.py' for preparing the dataset, I got this error. I can't import cpu.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with scripts/prepare_ade20k.py and inspect the import path through encoding/functions/encoding.py, encoding/init.py, and scripts/prepare_pascal.py. Determine why encoding.cpu is unavailable; the work is done when the dataset preparation command imports successfully without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.