pytorch / hub

Submission to https://pytorch.org/hub/
1.38k stars 240 forks source link

Need help on how to contribute #328

Closed Coderx7 closed 1 year ago

Coderx7 commented 1 year ago

Hello everyone. I wanted to add simplenet architecture from 2016 which outperforms vggnets resnet18, resbet34 and the likes while being a plain CNN with 5m to 9m parameters to the pytorch hub. I read the docs but I'm a bit confused. Could you kindly help me get this sorted out?

Here are my issues: 1.where exactly should I put the hubconf.py in my repository? My repository(Link ) is organized like this : -cifar10 -imagenet --simplenet.py --readme.md

Should I add the hubconf.py at the root of the repository, or next to the model inside the imagenet directory for this to work?

2.and to be clear, hubconf.py will only cobtain the functions for instantiating each model variant right? That is one entry for simplenetv1_5m1, another for simplenetv1_5m2, and so on right? And I should only import these from my simplenet.py right?

3.And then fork this repo, create a new .md file right? How should I name that file? Should I use my real name fir owner or my GitHub handle name? i.e. coderx7_SimpleNet_Pytorch_title? What should I write for title here? Can I leave it out? How many characters are allowed? Is the repo name case sensitive?

When I created all of that , I make a pull request and that's it?

NicolasHug commented 1 year ago

Hi @Coderx7

Should I add the hubconf.py at the root of the repository

Yes, add it at the root of your github repo. See e.g. how torchvision does it: https://github.com/pytorch/vision/blob/main/hubconf.py

2.and to be clear, hubconf.py will only cobtain the functions for instantiating each model variant right?

Correct, check the torchvision repo for inspiration as well

3.And then fork this repo, create a new .md file right?

You can do that if you want your models to be publicly exposed on the torchhub website https://pytorch.org/hub/. But you do not need to do it if all you want is your models to be available from torch.hub.load(...) - for that, you only need to perform steps 1 and 2 above.

I'd suggest doing 1 and 2 and then try to see if you can load your models by doing torch.hub.load("Coderx7/SimpleNet_Pytorch", "your_model_name"). Then if you want your model to show up on the website you can start looking into 3. (Note: I haven't looked at the details of your models yet, so I can't promise they fit our inclusion criteria for the website, but you can still do 1. and 2. !!)

Let us know if you need additional help.

Coderx7 commented 1 year ago

Thanks a lot really appreciate the kind and quick reply. by the way, are the names used in torch.hub.load case sensitive? Would you kindly elaborate a bit more on the details that need to be taken care of so it fits the website? what criterion should I be taking into account?

NicolasHug commented 1 year ago

by the way, are the names used in torch.hub.load case sensitive?

Yes, I think so

Would you kindly elaborate a bit more on the details that need to be taken care of so it fits the website?

We have pretty loose inclusion criteria and it is somewhat described in this comment https://github.com/pytorch/hub/issues/31#issuecomment-500696324. I took a brief look at the simplenet paper and from what I can tell I don't expect to be any issue to include it. If you'd like the model to be present on the website, feel free to submit a PR with a new simplenet.md file (take some inspiration e.g. from the resnet file: https://github.com/pytorch/hub/blob/master/pytorch_vision_resnet.md - and see also its "raw" version).

Coderx7 commented 1 year ago

@NicolasHug Thanks, I made a pr here, hopefully, this is useful for the community.