Skip to content

Commit

Permalink
Model sharing doc: more tweaks (#8520)
Browse files Browse the repository at this point in the history
* More doc tweaks

* Update model_sharing.rst

* make style

* missing newline

* Add email tip

Co-authored-by: Pierric Cistac <pierric@huggingface.co>
  • Loading branch information
julien-c and Pierrci authored Nov 13, 2020
1 parent 9d519da commit 7252697
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions docs/source/model_sharing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For instance:

.. code-block::
>>> tokenizer = AutoTokenizer.from_pretrained(
>>> model = AutoModel.from_pretrained(
>>> "julien-c/EsperBERTo-small",
>>> revision="v2.0.1" # tag name, or branch name, or commit hash
>>> )
Expand All @@ -46,10 +46,13 @@ Basic steps
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In order to upload a model, you'll need to first create a git repo. This repo will live on the model hub, allowing
users to clone it and you (and your organization members) to push to it. First, you should ensure you are logged in the
``transformers-cli``:
users to clone it and you (and your organization members) to push to it.

You can create a model repo directly from the website, `here <https://huggingface.co/new>`.

Alternatively, you can use the ``transformers-cli``. The next steps describe that process:

Go in a terminal and run the following command. It should be in the virtual environment where you installed 🤗
Go to a terminal and run the following command. It should be in the virtual environment where you installed 🤗
Transformers, since that command :obj:`transformers-cli` comes from the library.

.. code-block:: bash
Expand All @@ -63,14 +66,22 @@ Once you are logged in with your model hub credentials, you can start building y
transformers-cli repo create your-model-name
This creates a repo on the model hub, which can be cloned. You can then add/remove from that repo as you would with any
other git repo.
This creates a repo on the model hub, which can be cloned.

.. code-block:: bash
git clone https://huggingface.co/username/your-model-name
# Then commit as usual
# Make sure you have git-lfs installed
# (https://git-lfs.github.com/)
git lfs install
When you have your local clone of your repo and lfs installed, you can then add/remove from that clone as you would
with any other git repo.

.. code-block:: bash
# Commit as usual
cd your-model-name
echo "hello" >> README.md
git add . && git commit -m "Update from $USER"
Expand Down Expand Up @@ -251,16 +262,22 @@ Once it's created, you can clone it and configure it (replace username by your u

.. code-block:: bash
git clone https://huggingface.co/username/your-model-name
git clone https://username:password@huggingface.co/username/your-model-name
# Alternatively if you have a token,
# you can use it instead of your password
git clone https://username:token@huggingface.co/username/your-model-name
cd your-model-name
git lfs install
git config --global user.email "email@example.com"
# Tip: using the same email than for your huggingface.co account will link your commits to your profile
git config --global user.name "Your name"
Once you've saved your model inside, you can add it and push it with usual git commands. Note that you have to replace
`username:password` with your username and password to huggingface.co.
Once you've saved your model inside, and your clone is setup with the right remote URL, you can add it and push it with
usual git commands.

.. code-block:: bash
git add .
git commit -m "Initial commit"
git push https://username:password@huggingface.co/username/your-model-name
git push

0 comments on commit 7252697

Please sign in to comment.