Instructions to use powow/nougat-swe with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use powow/nougat-swe with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="powow/nougat-swe")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("powow/nougat-swe") model = AutoModelForMultimodalLM.from_pretrained("powow/nougat-swe") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use powow/nougat-swe with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "powow/nougat-swe" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "powow/nougat-swe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/powow/nougat-swe
- SGLang
How to use powow/nougat-swe with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "powow/nougat-swe" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "powow/nougat-swe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "powow/nougat-swe" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "powow/nougat-swe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use powow/nougat-swe with Docker Model Runner:
docker model run hf.co/powow/nougat-swe
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Nougat for Swedish
Fine-tuned version of facebook/nougat-small. Primarily trained on mathematical expressions and Swedish text.
Related code at: https://github.com/will-berg/nougat-swe
Inference
Code for inference on a pdf is in the GitHub repo, but can be done quickly on a provided image (of a pdf page) using the following code:
from PIL import Image
from transformers import NougatProcessor, VisionEncoderDecoderModel
import torch
processor = NougatProcessor.from_pretrained("powow/nougat-swe")
model = VisionEncoderDecoderModel.from_pretrained("powow/nougat-swe")
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
image = Image.open(image_path)
pixel_values = processor(image, return_tensors="pt").pixel_values
outputs = model.generate(
pixel_values.to(device),
min_length=1,
max_new_tokens=3584,
bad_words_ids=[[processor.tokenizer.unk_token_id]],
)
sequence = processor.batch_decode(outputs, skip_special_tokens=True)[0]
sequence = processor.post_process_generation(sequence, fix_markdown=False)
print(sequence)
- Downloads last month
- 4
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support