limuloo / PyDIff

[IJCAI 2023 ORAL] "Pyramid Diffusion Models For Low-light Image Enhancement" (Official Implementation)
Other
153 stars 8 forks source link

ModuleNotFoundError: No module named 'scripts.utils' #5

Closed Zeng555 closed 1 year ago

Zeng555 commented 1 year ago

I tried to use the model to inference, CUDA_VISIBLE_DEVICES=0 python pydiff/train.py -opt options/infer.yaml but it shows ModuleNotFoundError: No module named 'scripts.utils'

limuloo commented 1 year ago

Did you successfully run the "BASICSR_EXT=True sudo $(which python) setup.py develop" command in the "BasicSR-light" and "PyDiff" directories?

Zeng555 commented 1 year ago

I'll try again, thank you!

Zeng555 commented 1 year ago

I've installed 'ninja' package, but when I run the commend that you mentioned, it shows:

running develop running egg_info writing basicsr.egg-info/PKG-INFO writing dependency_links to basicsr.egg-info/dependency_links.txt writing top-level names to basicsr.egg-info/top_level.txt reading manifest file 'basicsr.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'basicsr.egg-info/SOURCES.txt' /home/ubuntu/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend. warnings.warn(msg.format('we could not find ninja.')) running build_ext Creating /home/ubuntu/anaconda3/lib/python3.8/site-packages/basicsr.egg-link (link to .) basicsr 1.3.4.4 is already the active version in easy-install.pth

Installed /home/ubuntu/pythonProject/PyDIff-main/BasicSR-light Processing dependencies for basicsr==1.3.4.4 Finished processing dependencies for basicsr==1.3.4.4

it this correctly installed?

limuloo commented 1 year ago

I've installed 'ninja' package, but when I run the commend that you mentioned, it shows:

running develop running egg_info writing basicsr.egg-info/PKG-INFO writing dependency_links to basicsr.egg-info/dependency_links.txt writing top-level names to basicsr.egg-info/top_level.txt reading manifest file 'basicsr.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'basicsr.egg-info/SOURCES.txt' /home/ubuntu/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend. warnings.warn(msg.format('we could not find ninja.')) running build_ext Creating /home/ubuntu/anaconda3/lib/python3.8/site-packages/basicsr.egg-link (link to .) basicsr 1.3.4.4 is already the active version in easy-install.pth

Installed /home/ubuntu/pythonProject/PyDIff-main/BasicSR-light

Processing dependencies for basicsr==1.3.4.4 Finished processing dependencies for basicsr==1.3.4.4 it this correctly installed?

This does not display an error, you can continue to execute subsequent commands to see if the inference is ok.

Zeng555 commented 1 year ago

I created a new conda environment, installed all of the packages, but still report same error......... xD

limuloo commented 1 year ago

I created a new conda environment, installed all of the packages, but still report same error......... xD

Can you share the all commands you run to start with creating the environment?

Zeng555 commented 1 year ago

1) first create conda environment: conda create -n PyDiff python=3.7 2) then acvitate it, and run: conda install pytorch==1.7.0 torchvision torchaudio cudatoolkit=11.0 -c pytorch 3) cd BasicSR-light 4) For some reason, I have to change pip source to install pip packages: pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple 5) cd ../PyDiff 6) same as Step 4), but the pip package"tb-nightly" does not exist in the Tsinghua University Source Lib, so I use pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple to install it 7) after all the packages installed, run the _"BASICSREXT=True sudo $(which python) setup.py develop" command in the "BasicSR-light" and "PyDiff" directories

limuloo commented 1 year ago
  1. first create conda environment: conda create -n PyDiff python=3.7
  2. then acvitate it, and run: conda install pytorch==1.7.0 torchvision torchaudio cudatoolkit=11.0 -c pytorch
  3. cd BasicSR-light
  4. For some reason, I have to change pip source to install pip packages: pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  5. cd ../PyDiff
  6. same as Step 4), but the pip package"tb-nightly" does not exist in the Tsinghua University Source Lib, so I use pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple to install it
  7. after all the packages installed, run the _"BASICSREXT=True sudo $(which python) setup.py develop" command in the "BasicSR-light" and "PyDiff" directories

you shold run "BASICSR_EXT=True sudo $(which python) setup.py develop" in "BasicSR-light" !!! before step 5 !!!

limuloo commented 1 year ago
  1. first create conda environment: conda create -n PyDiff python=3.7
  2. then acvitate it, and run: conda install pytorch==1.7.0 torchvision torchaudio cudatoolkit=11.0 -c pytorch
  3. cd BasicSR-light
  4. For some reason, I have to change pip source to install pip packages: pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  5. cd ../PyDiff
  6. same as Step 4), but the pip package"tb-nightly" does not exist in the Tsinghua University Source Lib, so I use pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple to install it
  7. after all the packages installed, run the _"BASICSREXT=True sudo $(which python) setup.py develop" command in the "BasicSR-light" and "PyDiff" directories

You also have to make sure that you are in the path of PyDIff/PyDiff/ when you perform inference, and then execute "CUDA_VISIBLE_DEVICES=0 python pydiff/train.py -opt options/infer.yaml"

Zeng555 commented 1 year ago

If I run BASICSR_EXT=True sudo $(which python) setup.py develop" in "BasicSR-light" before step 5, it shows image

Zeng555 commented 1 year ago
  1. first create conda environment: conda create -n PyDiff python=3.7
  2. then acvitate it, and run: conda install pytorch==1.7.0 torchvision torchaudio cudatoolkit=11.0 -c pytorch
  3. cd BasicSR-light
  4. For some reason, I have to change pip source to install pip packages: pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  5. cd ../PyDiff
  6. same as Step 4), but the pip package"tb-nightly" does not exist in the Tsinghua University Source Lib, so I use pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple to install it
  7. after all the packages installed, run the _"BASICSREXT=True sudo $(which python) setup.py develop" command in the "BasicSR-light" and "PyDiff" directories

You also have to make sure that you are in the path of PyDIff/PyDiff/ when you perform inference, and then execute "CUDA_VISIBLE_DEVICES=0 python pydiff/train.py -opt options/infer.yaml"

I'm sure that I was in the path of PyDIff/PyDiff/ when I perform inference

limuloo commented 1 year ago

If I run BASICSR_EXT=True sudo $(which python) setup.py develop" in "BasicSR-light" before step 5, it shows image

ReadTimeError, This looks like timed out error emerge when you pip install something.

Zeng555 commented 1 year ago

Thank you for your patiently reply, I have changed the GitHub URL in the original PyDiff/BasicSR light/setup.py file to https://gitclone.com/github.com/xinntao/Basicsr After that, I can download without any timeout errors image