Spaces:
Runtime error
Runtime error
gurgenblbulyan
commited on
Commit
•
5d7296b
1
Parent(s):
48e8be6
Update inference.py
Browse files- inference.py +2 -2
inference.py
CHANGED
@@ -23,8 +23,8 @@ class Inference:
|
|
23 |
self.tokenizer.add_special_tokens({'pad_token': '[PAD]'})
|
24 |
self.encoder_decoder_model.decoder.resize_token_embeddings(len(self.tokenizer))
|
25 |
|
26 |
-
generated_ids = self.encoder_decoder_model.generate(pixel_values.unsqueeze(0).to(self.device),early_stopping=True, max_length=self.max_length,num_beams=
|
27 |
-
no_repeat_ngram_size=
|
28 |
generated_text = self.tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
29 |
|
30 |
return generated_text
|
|
|
23 |
self.tokenizer.add_special_tokens({'pad_token': '[PAD]'})
|
24 |
self.encoder_decoder_model.decoder.resize_token_embeddings(len(self.tokenizer))
|
25 |
|
26 |
+
generated_ids = self.encoder_decoder_model.generate(pixel_values.unsqueeze(0).to(self.device),early_stopping=True, max_length=self.max_length,num_beams=4,
|
27 |
+
no_repeat_ngram_size=2 )
|
28 |
generated_text = self.tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
29 |
|
30 |
return generated_text
|