Update app.py
Browse files
app.py
CHANGED
@@ -198,6 +198,14 @@ def test():
|
|
198 |
|
199 |
def trans(text):
|
200 |
#test()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
return None
|
203 |
|
|
|
198 |
|
199 |
def trans(text):
|
200 |
#test()
|
201 |
+
llama = Llama(f"models/{model}")
|
202 |
+
tokens = llama.tokenize(b"translate English to German: The house is wonderful.")
|
203 |
+
llama.encode(tokens)
|
204 |
+
tokens = [llama.decoder_start_token()]
|
205 |
+
for token in llama.generate(tokens, top_k=40, top_p=0.95, temp=1, repeat_penalty=1.0):
|
206 |
+
print(llama.detokenize([token]))
|
207 |
+
if token == llama.token_eos():
|
208 |
+
break
|
209 |
|
210 |
return None
|
211 |
|