Separate repositories for models

#1
by merve HF staff - opened

Hello, great work with the model release!
It would be better if every model would be in different repositories. What do you think?

Berkeley AI Research Climate Initiative org

Hey! We found it really complicated to automate the deployment of weights to separate repos. Since we intend to use this as a way to distribute weights via hard links, we didn't think it was a large issue. If you think it is better to have separate repos, we can figure that out.

Hello @RitwikGupta yes, what is your workflow? I can help you out with that.

Berkeley AI Research Climate Initiative org

@merve We have weights that are split up by model size (Swin-T, Swin-L, Hiera, etc...). Within each folder we have the non-xT model and the various xT models (Swin-T Mamba, for example). All the weights currently live in one folder. Can we automatically create a new model for each one and then push the weights accordingly?

Hello @RitwikGupta I think you can iterate over each file in your folder and run something like this:

from huggingface_hub import create_repo, HfApi
create_repo(f"RitwikGupta/{filename}", repo_type="model") # e.g. RitwikGupta/Swin-T
api = HfApi()
api.upload_file(
    path_or_fileobj=f"{filename}",
    path_in_repo=f"{filename}",
    repo_id=f"RitwikGupta/{filename}"
    repo_type="model",
)

Does this work?

I'd also recommend to upload the configuration of each checkpoint and use consistent naming, such as config.yaml. This should make it easier to configure individualized download stats for the repos.

Sign up or log in to comment