# How to properly handle model versions

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-properly-handle-model-versions%2F24108%3E%5C
**Category:** 🤗Hub\
**Created:** [October 7, 2022, 1:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-properly-handle-model-versions%2F24108 "2022-10-07T13:08:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ichernev](https://avatars.discourse-cdn.com/v4/letter/i/91b2a8/32.png) [@ichernev](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fichernev)%5C
**Post date:** [October 7, 2022, 1:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-properly-handle-model-versions%2F24108%2F1 "2022-10-07T13:08:18Z")

</div>

I’m trying to figure out what is the right way to upload different versions of models to the hub and then download them (preferably using the string identifiers).

For example if my repo is `ichernev/my-model` how do I push `v1` and `v2` to it (github tags/branches maybe?), and then, when using it, how do I reference a version (something like `ichernev/my-model:v1`?). Is there a way to use github sha IDs when referencing models in `from_pretrained`/`pipeline` functions?

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fosanseviero)%5C
**Post date:** [October 21, 2022, 10:55am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-properly-handle-model-versions%2F24108%2F2 "2022-10-21T10:55:41Z")

</div>

You can push different versions as different commits. You can use the `revision` parameter to point to the specific commit hash when downloading.

From [Models](https://huggingface.co/docs/transformers/main_classes/model#transformers.PreTrainedModel.from_pretrained.revision)

- 
  - **revision** (`str`, _optional_, defaults to `"main"`) — The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a git-based system for storing models and other artifacts on [huggingface.co](http://huggingface.co), so `revision` can be any identifier allowed by git.

This also works with branches if you want to, but different commits for different versions makes sense!

---

<div class="post-metadata">

**Author:** ![gpldecah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/gpldecah/32/52630_2.png) [@gpldecah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fgpldecah)%5C
**Post date:** [November 17, 2023, 3:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-properly-handle-model-versions%2F24108%2F3 "2023-11-17T15:08:59Z")

</div>

I have a follow up question on this topic.

What is the purpose of having the flexibility of creating different branches of a model (in ui) whilst not being able to push a model to it using trainer.push\_to\_hub ? I might not be understanding the use-case of model branches.

I am new to the framework so trying to understand best practise for model versioning as well.
