File size: 999 Bytes
10a49a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import MistralForCausalLM
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained('mistralai/mathstral-7B-v0.1')

prompt = "What are the roots of unity?"
tokenized_prompts = tokenizer(prompt, return_tensors="pt") 

model = MistralForCausalLM.from_pretrained('mistralai/mathstral-7B-v0.1')
generation = model.generate(**tokenized_prompts, max_new_tokens=512)
print(tokenizer.decode(generation[0]))

""" <s>What are the roots of unity?

The roots of unity are the solutions to the equation $z^n = 1$, where $n$ is a positive integer.
These roots are complex numbers and they form a regular $n$-gon in the complex plane.

For example, the roots of unity for $n=1$ are just $1$,
and for $n=2$ they are $1$ and $-1$. For $n=3$, they are $1$, $\\frac{-1+\\sqrt{3}i}{2}$, and $\\frac{-1-\\sqrt{3}i}{2}$.

The roots of unity have many interesting properties and they are used in many areas of mathematics, including number theory, algebra, and geometry.</s>

"""