Image-to-Text
Transformers
PyTorch
Safetensors
vision-encoder-decoder
image-text-to-text
vision
nougat
Instructions to use HongxuanLi/nougat-base-deploy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HongxuanLi/nougat-base-deploy 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="HongxuanLi/nougat-base-deploy")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("HongxuanLi/nougat-base-deploy") model = AutoModelForMultimodalLM.from_pretrained("HongxuanLi/nougat-base-deploy", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Hongxuan Li commited on
Commit ·
9308c9e
1
Parent(s): d21a961
add handler
Browse files- handler.py +1 -1
handler.py
CHANGED
|
@@ -10,7 +10,7 @@ class EndpointHandler():
|
|
| 10 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
self.processor = NougatProcessor.from_pretrained(path)
|
| 12 |
self.model = VisionEncoderDecoderModel.from_pretrained(path)
|
| 13 |
-
self.model = model.to(self.device)
|
| 14 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
| 15 |
"""
|
| 16 |
Args:
|
|
|
|
| 10 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
self.processor = NougatProcessor.from_pretrained(path)
|
| 12 |
self.model = VisionEncoderDecoderModel.from_pretrained(path)
|
| 13 |
+
self.model = self.model.to(self.device)
|
| 14 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
| 15 |
"""
|
| 16 |
Args:
|