Instructions to use microsoft/trocr-base-printed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/trocr-base-printed with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="microsoft/trocr-base-printed")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/trocr-base-printed") model = AutoModelForMultimodalLM.from_pretrained("microsoft/trocr-base-printed", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update preprocessor_config.json
Browse filesGot this warning while running.
Could not find image processor class in the image processor config or the model config. Loading based on pattern matching with the model's feature extractor configuration. Please open a PR/issue to update `preprocessor_config.json` to use `image_processor_type` instead of `feature_extractor_type`. This warning will be removed in v4.40.
- preprocessor_config.json +1 -1
preprocessor_config.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"do_normalize": true,
|
| 3 |
"do_resize": true,
|
| 4 |
-
"
|
| 5 |
"image_mean": [
|
| 6 |
0.5,
|
| 7 |
0.5,
|
|
|
|
| 1 |
{
|
| 2 |
"do_normalize": true,
|
| 3 |
"do_resize": true,
|
| 4 |
+
"image_processor_type": "ViTFeatureExtractor",
|
| 5 |
"image_mean": [
|
| 6 |
0.5,
|
| 7 |
0.5,
|