traintogpb commited on
Commit
9101027
1 Parent(s): bfd119d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -0
README.md CHANGED
@@ -70,6 +70,10 @@ pipeline_tag: translation
70
  inputs['attention_mask'] = inputs['attention_mask'][0][:-1].unsqueeze(dim=0)
71
 
72
  outputs = model.generate(**inputs, max_length=768, eos_token_id=tokenizer.eos_token_id)
 
 
 
 
73
  ```
74
 
75
  ### Framework versions
 
70
  inputs['attention_mask'] = inputs['attention_mask'][0][:-1].unsqueeze(dim=0)
71
 
72
  outputs = model.generate(**inputs, max_length=768, eos_token_id=tokenizer.eos_token_id)
73
+
74
+ input_len = len(inputs['input_ids'].squeeze())
75
+ translation = tokenizer.decode(outputs[0][input_len:], skip_special_tokens=True)
76
+ print(translation)
77
  ```
78
 
79
  ### Framework versions