Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'dsketch.experiments' #1

Closed
Chauban opened this issue Dec 20, 2021 · 5 comments
Closed

No module named 'dsketch.experiments' #1

Chauban opened this issue Dec 20, 2021 · 5 comments

Comments

@Chauban
Copy link

Chauban commented Dec 20, 2021

Hello. After download and install these file step by step, I run the example code
imageopt --loss LPIPSLoss --net vgg --invert --seed 1234 --width 300 --lines 2000 --init-sigma2 1.0 --final-sigma2 1.0 --iters 500 --lr 0.01 --init-raster results/vancouver/init.png --final-raster results/vancouver/final.png --init-pdf results/vancouver/init.pdf --final-pdf results/vancouver/final.pdf --snapshots-path results/vancouver data/vancouver.jpg --snapshots-steps 100 --colour

But I get this error, how to address it please?

Traceback (most recent call last):
File "/usr/local/bin/imageopt", line 33, in
sys.exit(load_entry_point('DifferentiableSketching==0.0.1', 'console_scripts', 'imageopt')())
File "/usr/local/bin/imageopt", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/local/lib/python3.7/dist-packages/importlib_metadata/init.py", line 194, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 953, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 953, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dsketch.experiments'

@jonhare
Copy link
Owner

jonhare commented Dec 20, 2021

Its possible that you've got multiple python versions and installed the package using python 2 rather than 3. Try reinstalling with:

pip3 -r requirements.txt
python3 setup.py install

@Chauban
Copy link
Author

Chauban commented Dec 20, 2021

Its possible that you've got multiple python versions and installed the package using python 2 rather than 3. Try reinstalling with:

pip3 -r requirements.txt
python3 setup.py install

It cannot run yet. However, I move the file "imageopt.py" into the ../../..,just in the DifferentiableSketching. It can run but another error occured. It looks strange.

/usr/local/lib/python3.7/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off]
Loading model from: /usr/local/lib/python3.7/dist-packages/lpips/weights/v0.1/vgg.pth
0% 1/500 [01:33<12:53:59, 93.06s/it, loss=0.725, sigma^2=0.000264]^C

@jonhare
Copy link
Owner

jonhare commented Dec 20, 2021

That was just a warning... no errors there. When you ctrl-c'd it was running (very very slowly!) - you need a cuda capable GPU to get a reasonable speed I think.

@Chauban
Copy link
Author

Chauban commented Dec 21, 2021

That was just a warning... no errors there. When you ctrl-c'd it was running (very very slowly!) - you need a cuda capable GPU to get a reasonable speed I think.

Well, I think it is not a warning...I use the colab, when the command run, firstly it will output

/usr/local/lib/python3.7/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off]
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to /root/.cache/torch/hub/checkpoints/vgg16-397923af.pth
100% 528M/528M [00:04<00:00, 113MB/s]
Loading model from: /usr/local/lib/python3.7/dist-packages/lpips/weights/v0.1/vgg.pth
0% 0/500 [00:00<?, ?it/s]

After one or two minutes, it will become below and stop running

/usr/local/lib/python3.7/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off]
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to /root/.cache/torch/hub/checkpoints/vgg16-397923af.pth
100% 528M/528M [00:04<00:00, 113MB/s]
Loading model from: /usr/local/lib/python3.7/dist-packages/lpips/weights/v0.1/vgg.pth
0% 1/500 [01:27<12:11:24, 87.95s/it, loss=0.725, sigma^2=0.000264]^C

@jonhare
Copy link
Owner

jonhare commented Dec 30, 2021

See #4 for the fix to the original "no module named ..." question (hopefully now fixed). The snippet of output above was indicating it running successfully, but very very slowly at the point it was ctrl-c'd. I suspect that a cpu-only version of pytorch is being used (or the VM doesn't have the GPU activated) as it should be much faster.

@jonhare jonhare closed this as completed Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants