apple / ml-cvnets

CVNets: A library for training computer vision networks
https://apple.github.io/ml-cvnets
Other
1.76k stars 225 forks source link

How to solve this problem:ModuleNotFoundError: No module named 'cvnets.models.classification.' #101

Open acrlife opened 10 months ago

acrlife commented 10 months ago

Hi@sacmehta @mchorton When I comment out "self.check_model()" in "./ml-cvnets/cvnets/models/classification/mobilevit.py",and run command as figure1,I got a error as figure2. I uncomment "self.check_model()",run command again,but also got this error. How to solve this problem? Thank you very much! 1 2

mchorton commented 10 months ago

@acrlife it looks like python cannot find the module - is CVNets missing from your pythonpath? Assuming you're running from the root directory in the CVNets repository, try adding PYTHONPATH=. before your command.

acrlife commented 10 months ago

@mchorton I have found reason of this problem: When I installed cvnets ,command cvnets-train can works, but it does't work after I add my own model file named "denseformer.py" to "ml-cvnets/cvnets/models/classification". I have try to reinstall cvnets by pip install --editable ., but it also does't work. Figure 1 shows the situation after just installing CVnets, and Figure 2 shows the situation after adding my own model file. I really want to know how to train my own model using CVNets,thank you! 5 6

mchorton commented 10 months ago

The error implies you're trying to import cvnets.models.classification.config somewhere. Since the config folder isn't a module, you're getting an import error. I think you meant to remove the config from your import statement.

acrlife commented 10 months ago

@mchorton I think CVNets has built a fully functional framework for the main tasks in the field of computer vision. I would like to know how to use CVNets to train my own model. Can you provide a tutorial? Thank you very much!

mchorton commented 10 months ago

@acrlife we have documentation here: https://apple.github.io/ml-cvnets/getting_started.html

I believe your issue involved importing the wrong directory, as mentioned above. If you are still having trouble, try this: