Image-to-Text
Transformers
PyTorch
Safetensors
vision-encoder-decoder
image-text-to-text
vision
nougat
Instructions to use facebook/nougat-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/nougat-base 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-base")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("facebook/nougat-base") model = AutoModelForImageTextToText.from_pretrained("facebook/nougat-base") - Notebooks
- Google Colab
- Kaggle
add handler.py for HF Dedicated Inference
#14
by jmbrito - opened
This PR adds a Inference Handler to this model.
This is required for using it in a HuggingFace Dedicated Endpoint, since this product does not has a Image-To-Text task available out-of-the-box.
The handler implements the inference as described in the model docs but with the StoppingCriteria implemented on the notebook example.
Hi,
Note that this isn't required to be added to this repo. The only thing you need is defining a custom_handler.py in a new HF model repo which uses:
from transformers import VisionEncoderDecoderModel
model = VisionEncoderDecoderModel.from_pretrained("facebook/nougat-base")
, no need to push anything to this repo.
See this blog post as an example: https://www.philschmid.de/stable-diffusion-controlnet-endpoint.