Skip to content

Commit 94fa47a

Browse files
authored
Update Mistral LLMs notebook (#402)
1 parent 39f44c7 commit 94fa47a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

notebooks/llms.livemd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ Nx.Serving.batched_run(Llama, prompt) |> Enum.each(&IO.write/1)
9090

9191
We can easily test other LLMs, we just need to change the repository and possibly adjust the prompt template. In this example we run the [Mistral](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) model.
9292

93+
Just like Llama, Mistral now also requires users to request access to their models, so make sure you are granted access to the model, then generate a [HuggingFace auth token](https://huggingface.co/settings/tokens) and put it in a `HF_TOKEN` Livebook secret.
94+
9395
```elixir
94-
repo = {:hf, "mistralai/Mistral-7B-Instruct-v0.2"}
96+
hf_token = System.fetch_env!('LB_HF_TOKEN')
97+
repo = {:hf, "mistralai/Mistral-7B-Instruct-v0.2", auth_token: hf_token}
9598

9699
{:ok, model_info} = Bumblebee.load_model(repo, type: :bf16, backend: EXLA.Backend)
97100
{:ok, tokenizer} = Bumblebee.load_tokenizer(repo)
@@ -109,7 +112,7 @@ generation_config =
109112

110113
serving =
111114
Bumblebee.Text.generation(model_info, tokenizer, generation_config,
112-
compile: [batch_size: 1, sequence_length: 1028],
115+
compile: [batch_size: 1, sequence_length: 512],
113116
stream: true,
114117
defn_options: [compiler: EXLA]
115118
)

0 commit comments

Comments
 (0)