Commit
•
8d4bfcd
1
Parent(s):
c4c1dbe
updated readme.md usage example again
Browse files
README.md
CHANGED
@@ -34,18 +34,18 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
34 |
model.to(device)
|
35 |
|
36 |
def get_latex(text):
|
37 |
-
inputs = tokenizer(text, return_tensors='pt').to(device)
|
38 |
-
with torch.no_grad():
|
39 |
-
hypotheses = model.generate(
|
40 |
-
**inputs,
|
41 |
-
do_sample=True, num_return_sequences=1,
|
42 |
-
repetition_penalty=1.2,
|
43 |
-
max_length=len(text),
|
44 |
-
num_beams=10,
|
45 |
-
early_stopping=True
|
46 |
-
)
|
47 |
-
for h in hypotheses:
|
48 |
-
display(Latex(tokenizer.decode(h, skip_special_tokens=True)))
|
49 |
|
50 |
text = '''лямбда прописная квадрат минус три равно десять игрек куб
|
51 |
При этом шинус икс равен интеграл от экспоненты до трёх игрек штрих'''
|
|
|
34 |
model.to(device)
|
35 |
|
36 |
def get_latex(text):
|
37 |
+
inputs = tokenizer(text, return_tensors='pt').to(device)
|
38 |
+
with torch.no_grad():
|
39 |
+
hypotheses = model.generate(
|
40 |
+
**inputs,
|
41 |
+
do_sample=True, num_return_sequences=1,
|
42 |
+
repetition_penalty=1.2,
|
43 |
+
max_length=len(text),
|
44 |
+
num_beams=10,
|
45 |
+
early_stopping=True
|
46 |
+
)
|
47 |
+
for h in hypotheses:
|
48 |
+
display(Latex(tokenizer.decode(h, skip_special_tokens=True)))
|
49 |
|
50 |
text = '''лямбда прописная квадрат минус три равно десять игрек куб
|
51 |
При этом шинус икс равен интеграл от экспоненты до трёх игрек штрих'''
|