Fix code example
Browse files
README.md
CHANGED
@@ -36,10 +36,9 @@ processor = TrOCRProcessor.from_pretrained('microsoft/trocr-large-stage1')
|
|
36 |
model = VisionEncoderDecoderModel.from_pretrained('microsoft/trocr-large-stage1')
|
37 |
|
38 |
# training
|
39 |
-
pixel_values = processor(
|
40 |
-
|
41 |
-
outputs = model(pixel_values=pixel_values,
|
42 |
-
loss = outputs.loss
|
43 |
```
|
44 |
|
45 |
### BibTeX entry and citation info
|
|
|
36 |
model = VisionEncoderDecoderModel.from_pretrained('microsoft/trocr-large-stage1')
|
37 |
|
38 |
# training
|
39 |
+
pixel_values = processor(image, return_tensors="pt").pixel_values # Batch size 1
|
40 |
+
decoder_input_ids = torch.tensor([[model.config.decoder.decoder_start_token_id]])
|
41 |
+
outputs = model(pixel_values=pixel_values, decoder_input_ids=decoder_input_ids)
|
|
|
42 |
```
|
43 |
|
44 |
### BibTeX entry and citation info
|