Instructions to use nielsr/pix2seq-simple with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nielsr/pix2seq-simple with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nielsr/pix2seq-simple")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("nielsr/pix2seq-simple", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nielsr/pix2seq-simple with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nielsr/pix2seq-simple" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nielsr/pix2seq-simple", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nielsr/pix2seq-simple
- SGLang
How to use nielsr/pix2seq-simple 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 "nielsr/pix2seq-simple" \ --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": "nielsr/pix2seq-simple", "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 "nielsr/pix2seq-simple" \ --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": "nielsr/pix2seq-simple", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nielsr/pix2seq-simple with Docker Model Runner:
docker model run hf.co/nielsr/pix2seq-simple
Download config.json from nielsr/pix2seq-simple: direct link, hf CLI and curl.
- Browser
- Download file 937 Bytes
-
https://huggingface.co/nielsr/pix2seq-simple/resolve/main/config.json
- Command line
-
hf download hf://nielsr/pix2seq-simple/config.json
-
curl -L -o config.json https://huggingface.co/nielsr/pix2seq-simple/resolve/main/config.json
937 Bytes
| { | |
| "architectures": [ | |
| "Pix2SeqForConditionalGeneration" | |
| ], | |
| "attention_probs_dropout_prob": 0.0, | |
| "bos_token_id": 10, | |
| "dec_proj_mode": "mlp", | |
| "dim_decoder": 512, | |
| "drop_path_rate": 0.1, | |
| "hidden_act": "gelu", | |
| "hidden_dropout_prob": 0.0, | |
| "hidden_size": 768, | |
| "image_size": 640, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 3072, | |
| "is_encoder_decoder": true, | |
| "layer_norm_eps": 1e-12, | |
| "max_position_embeddings": 512, | |
| "model_type": "pix2seq", | |
| "num_attention_heads_decoder": 16, | |
| "num_attention_heads_encoder": 12, | |
| "num_channels": 3, | |
| "num_decoder_layers": 6, | |
| "num_encoder_layers": 12, | |
| "output_bias": true, | |
| "patch_size": 16, | |
| "positional_encoding": "sin_cos", | |
| "positional_encoding_decoder": "learned", | |
| "qkv_bias": true, | |
| "tie_word_embeddings": false, | |
| "torch_dtype": "float32", | |
| "transformers_version": "4.19.0.dev0", | |
| "use_cache": true, | |
| "use_cls_token": false, | |
| "vocab_size": 3000 | |
| } | |