Model sharing doc: more tweaks (#8520)

* More doc tweaks

* Update model_sharing.rst

* make style

* missing newline

* Add email tip

Co-authored-by: Pierric Cistac <pierric@huggingface.co>
This commit is contained in:
Julien Chaumond 2020-11-13 18:10:26 +01:00 committed by GitHub
parent 9d519dabb7
commit 725269746b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ For instance:
.. code-block:: .. code-block::
>>> tokenizer = AutoTokenizer.from_pretrained( >>> model = AutoModel.from_pretrained(
>>> "julien-c/EsperBERTo-small", >>> "julien-c/EsperBERTo-small",
>>> revision="v2.0.1" # tag name, or branch name, or commit hash >>> revision="v2.0.1" # tag name, or branch name, or commit hash
>>> ) >>> )
@ -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 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 users to clone it and you (and your organization members) to push to it.
``transformers-cli``:
Go in a terminal and run the following command. It should be in the virtual environment where you installed 🤗 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 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. Transformers, since that command :obj:`transformers-cli` comes from the library.
.. code-block:: bash .. code-block:: bash
@ -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 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 This creates a repo on the model hub, which can be cloned.
other git repo.
.. code-block:: bash .. code-block:: bash
git clone https://huggingface.co/username/your-model-name 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 cd your-model-name
echo "hello" >> README.md echo "hello" >> README.md
git add . && git commit -m "Update from $USER" git add . && git commit -m "Update from $USER"
@ -251,16 +262,22 @@ Once it's created, you can clone it and configure it (replace username by your u
.. code-block:: bash .. 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 cd your-model-name
git lfs install git lfs install
git config --global user.email "email@example.com" 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 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
`username:password` with your username and password to huggingface.co. usual git commands.
.. code-block:: bash .. code-block:: bash
git add . git add .
git commit -m "Initial commit" git commit -m "Initial commit"
git push https://username:password@huggingface.co/username/your-model-name git push