Image-to-Text
Transformers
PyTorch
Safetensors
vision-encoder-decoder
image-text-to-text
vision
nougat
Instructions to use facebook/nougat-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/nougat-small 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="facebook/nougat-small")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("facebook/nougat-small") model = AutoModelForImageTextToText.from_pretrained("facebook/nougat-small") - Notebooks
- Google Colab
- Kaggle
How to export nougat model to onnx?
#8
by zhichyu - opened
Here's one exported to onnx https://huggingface.co/pszemraj/nougat-small-onnx.
There are three onnx model files after export: decoder_model.onnx, decoder_with_past_model.onnx, encoder_model.onnx.
However the author doesn't provide the details how he did that.
torch.onnx.export only export one model file model.onnx, and ORTModelForVision2Seq connot load it:
FileNotFoundError: Could not find any ONNX model file for the regex ['(.*)?decoder((?!(with_past|merged)).)*?\\.onnx'] in /home/zhichyu/model_dir/nougat.
Got clue from https://github.com/facebookresearch/nougat/issues/49optimum-cli will take care all of that.
zhichyu changed discussion status to closed