From 7d93f93f83bce983d6bb142155444f6e992a3ca9 Mon Sep 17 00:00:00 2001 From: Fanli Lin Date: Mon, 19 May 2025 21:14:21 +0800 Subject: [PATCH] [docs] minor fixes in `models.md` (#38193) minor gix --- docs/source/en/models.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/en/models.md b/docs/source/en/models.md index cc897dcc95..4cef0d1553 100644 --- a/docs/source/en/models.md +++ b/docs/source/en/models.md @@ -54,8 +54,8 @@ For each model type, there is a separate class for each machine learning framewo from transformers import AutoModelForCausalLM, MistralForCausalLM # load with AutoClass or model-specific class -model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", , torch_dtype="auto", device_map="auto") -model = MistralForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", , torch_dtype="auto", device_map="auto") +model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", torch_dtype="auto", device_map="auto") +model = MistralForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", torch_dtype="auto", device_map="auto") ``` @@ -272,6 +272,7 @@ Explicitly set the [torch_dtype](https://pytorch.org/docs/stable/tensor_attribut ```py +import torch from transformers import AutoModelForCausalLM gemma = AutoModelForCausalLM.from_pretrained("google/gemma-7b", torch_dtype=torch.float16)