Add max_length parameter
Browse files
README.md
CHANGED
@@ -52,7 +52,7 @@ text = "ギルガメッシュ討伐戦"
|
|
52 |
def translate(text_src):
|
53 |
embeddings = src_tokenizer(text_src, return_attention_mask=False, return_token_type_ids=False, return_tensors='pt')
|
54 |
embeddings = {k: v for k, v in embeddings.items()}
|
55 |
-
output = model.generate(**embeddings)[0, 1:-1]
|
56 |
text_trg = trg_tokenizer.decode(output.cpu())
|
57 |
return text_trg
|
58 |
|
|
|
52 |
def translate(text_src):
|
53 |
embeddings = src_tokenizer(text_src, return_attention_mask=False, return_token_type_ids=False, return_tensors='pt')
|
54 |
embeddings = {k: v for k, v in embeddings.items()}
|
55 |
+
output = model.generate(**embeddings, max_length=500)[0, 1:-1]
|
56 |
text_trg = trg_tokenizer.decode(output.cpu())
|
57 |
return text_trg
|
58 |
|