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

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

Open
acrlife opened this issue Oct 27, 2023 · 5 comments

Comments

@acrlife
Copy link

acrlife commented Oct 27, 2023

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
Copy link
Collaborator

@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
Copy link
Author

acrlife commented Oct 30, 2023

@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
Copy link
Collaborator

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
Copy link
Author

acrlife commented Oct 31, 2023

@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
Copy link
Collaborator

mchorton commented Oct 31, 2023

@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:

  • Revert all your code changes, so that your branch matches the main branch.
  • Add your model definition to an existing .py file in which some other model is defined. That way, you can rule out an import error.

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