Clarify HuggingFace token handling in workspace, noting the standard CLI location and adding support for an environment variable.
This commit is contained in:
parent
cd2f2209d0
commit
fe531aef06
@ -20,19 +20,19 @@ download models.
|
||||
* store the token on your machine (replace the placeholder with your actual
|
||||
token):
|
||||
|
||||
You can use the `HUGGINGFACE_TOKEN` environment variable to store the token or use
|
||||
its standard location:
|
||||
```
|
||||
echo -n <hf_my_token> > `$HOME/.cache/huggingface/token`
|
||||
mkdir -p $HOME/.cache/huggingface/; echo <hf_my_token> > "$HOME/.cache/huggingface/token"
|
||||
```
|
||||
|
||||
The `-n` is important in order to not append an "end of line" character at the
|
||||
end of the file that would corrupt the token.
|
||||
|
||||
Now you're ready to download a gated model like `Meta-Llama-3-8b`!
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
# requires token in $HOME/.cache/huggingface/token
|
||||
# requires token in $HOME/.cache/huggingface/token, as created by the
|
||||
# `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable.
|
||||
cd examples
|
||||
bazel run -c opt //llama:Meta-Llama-3-8b
|
||||
bazel run -c opt //llama:Meta-Llama-3-8b -- --promt="Once upon a time,"
|
||||
|
||||
@ -3,7 +3,10 @@
|
||||
Some models have restrictions and may require some sort of approval or agreement
|
||||
process, which, by consequence, **requires token-authentication with Huggingface**.
|
||||
|
||||
Here is how you can generate a **"read-only public repositories"** access token to log into your account on Huggingface, directly from `bazel`, in order to download models.
|
||||
The easiest way might be to use the `huggingface-cli login` command.
|
||||
|
||||
Alternatively, here is how you can generate a **"read-only public repositories"**
|
||||
access token to log into your account on Huggingface, directly from `bazel`, in order to download models.
|
||||
|
||||
* log in at [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).
|
||||
* click on "Create new token"
|
||||
@ -14,18 +17,19 @@ Here is how you can generate a **"read-only public repositories"** access token
|
||||
* the token looks something like `hf_abCdEfGhijKlM`.
|
||||
* store the token on your machine (replace the placeholder with your actual token):
|
||||
|
||||
You can use the `HUGGINGFACE_TOKEN` environment variable to store the token or use
|
||||
its standard location:
|
||||
```
|
||||
mkdir -p $HOME/.cache/huggingface/; echo -n <hf_my_token> > "$HOME/.cache/huggingface/token"
|
||||
mkdir -p $HOME/.cache/huggingface/; echo <hf_my_token> > "$HOME/.cache/huggingface/token"
|
||||
```
|
||||
|
||||
The `-n` is important in order to not append an "end of line" character at the end of the file that would corrupt the token.
|
||||
|
||||
Now you're ready to download a gated model like `Meta-Llama-3-8b`!
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
# requires token in $HOME/.cache/huggingface/token
|
||||
# requires token in $HOME/.cache/huggingface/token, as created by the
|
||||
# `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable.
|
||||
cd examples
|
||||
bazel run -c opt //llama:Meta-Llama-3-8b
|
||||
bazel run -c opt //llama:Meta-Llama-3-8b -- --promt="Once upon a time,"
|
||||
|
||||
@ -93,7 +93,8 @@ Once you've been granted access, you're ready to download a gated model like
|
||||
`Meta-Llama-3-8b`!
|
||||
|
||||
```
|
||||
# requires token in $HOME/.cache/huggingface/token
|
||||
# requires token in $HOME/.cache/huggingface/token, as created by the
|
||||
# `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable.
|
||||
cd examples
|
||||
bazel run -c opt //llama:Meta-Llama-3-8b
|
||||
bazel run -c opt //llama:Meta-Llama-3-8b -- --promt="Once upon a time,"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user