Create Readme.md
#3
by
vladman-25
- opened
Readme.md
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Simple way to use the model
|
2 |
+
|
3 |
+
<code>
|
4 |
+
model_name = "sanjeev498/en-to-romanian"
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
6 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
7 |
+
model = model.half()
|
8 |
+
model.to("cuda")
|
9 |
+
|
10 |
+
sentences = ["This is a test"]
|
11 |
+
|
12 |
+
inputs = tokenizer(sentences, padding=True, return_tensors="pt").to("cuda")
|
13 |
+
translated_tokens = model.generate(
|
14 |
+
**inputs
|
15 |
+
)
|
16 |
+
translations = tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)
|
17 |
+
</code>
|