Helium documentation fixes (#36170)
* Helium documentation fixes * Update helium.md * Update helium.md * Update helium.md
This commit is contained in:
@@ -107,7 +107,7 @@ Tips:
|
||||
|
||||
## Usage tips
|
||||
|
||||
`Helium` can be found on the [Huggingface Hub](https://huggingface.co/collections/kyutai/helium-1-preview)
|
||||
`Helium` can be found on the [Huggingface Hub](https://huggingface.co/models?other=helium)
|
||||
|
||||
In the following, we demonstrate how to use `helium-1-preview` for the inference.
|
||||
|
||||
@@ -115,16 +115,12 @@ In the following, we demonstrate how to use `helium-1-preview` for the inference
|
||||
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
>>> device = "cuda" # the device to load the model onto
|
||||
|
||||
>>> model = AutoModelForCausalLM.from_pretrained("helium-1-preview", device_map="auto")
|
||||
>>> tokenizer = AutoTokenizer.from_pretrained("helium-1-preview")
|
||||
>>> model = AutoModelForCausalLM.from_pretrained("kyutai/helium-1-preview-2b", device_map="auto")
|
||||
>>> tokenizer = AutoTokenizer.from_pretrained("kyutai/helium-1-preview-2b")
|
||||
|
||||
>>> prompt = "Give me a short introduction to large language model."
|
||||
|
||||
>>> messages = [{"role": "user", "content": prompt}]
|
||||
|
||||
>>> text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||
|
||||
>>> model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
||||
>>> model_inputs = tokenizer(prompt, return_tensors="pt").to(device)
|
||||
|
||||
>>> generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512, do_sample=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user