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

Error when using direct tests #6

Closed
icewindi opened this issue Jul 29, 2024 · 6 comments
Closed

Error when using direct tests #6

icewindi opened this issue Jul 29, 2024 · 6 comments

Comments

@icewindi
Copy link

Thank you for your wonderful work. However, I am having problems with the direct testing process. When using the Demo direct test, it did not run successfully. The following error appears:

File "test_histoformer.py", line 15, in
from basicsr.models.archs.histoformer_arch import Histoformer
File "D:\code\Histoformer-main\basicsr\models_init_.py", line 16, in
model_modules = [
File "D:\code\Histoformer-main\basicsr\models_init
.py", line 17, in
importlib.import_module(f'models.{file_name}')
File "C:\Users\anaconda3\envs\dez\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'models'

Would you be able to advise where the code is having problems, thanks.

@sunshangquan
Copy link
Owner

Hi @icewindi , I guess the problem comes the logic difference of appending path between my Linux server and your machine. You could try (a) modifying the path at test_histoformer.py L14 into your path, and if it does not work, then try (b) adding "basicsr" to "D:\code\Histoformer-main\basicsr\models_init.py", line 17, which will be importlib.import_module(f'basicsr.models.{file_name}') .

My local Linux machine and remote server also have such kind of difference in terms of whether "basicsr" is needed during running training and testing. It has two potential reasons, i.e., a) whether you are calling the "basicsr" that is pip-installed or the one at Histoformer path; b) whether your root or appended path is at Histoformer or Histoformer/basicsr. The similar issues are also found in Restormer.

I will check this issue in a few days and update it into a more versatile way by testing on several more machines.

@icewindi
Copy link
Author

Thank you for your reply. I tried adding “basicsr” to solve the problem and successfully tested it. However, running the code correctly in my environment still requires adjusting the location of multiple libraries to run correctly.

@sunshangquan
Copy link
Owner

Glad that you solved it! I also met the issue before on a different machine and need to adjust libraries in multiple files. I will tune them in a few days into a more versatile way.

@ll000x
Copy link

ll000x commented Aug 17, 2024

您好 我是初学者,首先您的代码是要在linux系统跑吗,其次若您方便的话可以出比较详细的运行操作吗 谢谢您

@sunshangquan
Copy link
Owner

Hi @ll000x , yes the code was run on Linux. Sorry but I was preparing other works in the last weeks. I will fix this problem in a few days. You could try yourself and if you meet any specific problem, please feel free to open another issue.

@sunshangquan
Copy link
Owner

Hi @icewindi @ll000x , I have fixed the import issues on another local machine. Please feel free to raise them if there are remaining issues.

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

3 participants