Skip to content

Commit 0d312f1

Browse files
Update README.md
Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>
1 parent 7570d71 commit 0d312f1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ from transformers import AutoTokenizer
5353
- from transformers import AutoModelForCausalLM
5454
+ from optimum.intel.ipex import IPEXModelForCausalLM
5555

56-
- model = AutoModelForCausalLM.from_pretrained(
57-
+ model = IPEXModelForCausalLM.from_pretrained(
58-
"gpt2",
59-
torch_dtype=torch.bfloat16,
60-
export=True,
61-
)
56+
57+
model_id = "gpt2"
58+
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16)
59+
+ model = IPEXModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, export=True)
6260
tokenizer = AutoTokenizer.from_pretrained("gpt2")
6361
input_sentence = ["Answer the following yes/no question by reasoning step-by-step please. Can you write a whole Haiku in a single tweet?"]
6462
model_inputs = tokenizer(input_sentence, return_tensors="pt")

0 commit comments

Comments
 (0)