Views
No views yet

pipeline() function from 🤗 Transformers:1import torch
2from transformers import pipeline
3
4pipe = pipeline("text-generation", model="AI-MO/NuminaMath-72B-CoT", torch_dtype=torch.bfloat16, device_map="auto")
5
6messages = [
7 {"role": "user", "content": "For how many values of the constant $k$ will the polynomial $x^{2}+kx+36$ have two distinct integer roots?"},
8]
9prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
10
11gen_config = {
12 "max_new_tokens": 1024,
13 "do_sample": False,
14 "tokenizer": pipe.tokenizer,
15}
16
17outputs = pipe(prompt, **gen_config)
18text = outputs[0]["generated_text"]
19print(text)@misc{numina_math_7b,
author = {Edward Beeching and Shengyi Costa Huang and Albert Jiang and Jia Li and Benjamin Lipkin and Zihan Qina and Kashif Rasul and Ziju Shen and Roman Soletskyi and Lewis Tunstall},
title = {NuminaMath 72B CoT},
year = {2024},
publisher = {Numina & Hugging Face},
journal = {Hugging Face repository},
howpublished = {\url{https://huggingface.co/AI-MO/NuminaMath-72B-CoT}}
}