Instructions to use TeeA/pix2struct-ChartQA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TeeA/pix2struct-ChartQA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TeeA/pix2struct-ChartQA")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("TeeA/pix2struct-ChartQA") model = AutoModelForImageTextToText.from_pretrained("TeeA/pix2struct-ChartQA") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TeeA/pix2struct-ChartQA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TeeA/pix2struct-ChartQA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TeeA/pix2struct-ChartQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TeeA/pix2struct-ChartQA
- SGLang
How to use TeeA/pix2struct-ChartQA 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 "TeeA/pix2struct-ChartQA" \ --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": "TeeA/pix2struct-ChartQA", "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 "TeeA/pix2struct-ChartQA" \ --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": "TeeA/pix2struct-ChartQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TeeA/pix2struct-ChartQA with Docker Model Runner:
docker model run hf.co/TeeA/pix2struct-ChartQA
Upload Pix2StructForConditionalGeneration
Browse files- config.json +34 -0
- generation_config.json +8 -0
- model.safetensors +3 -0
config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "ybelkada/pix2struct-base",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Pix2StructForConditionalGeneration"
|
| 5 |
+
],
|
| 6 |
+
"decoder_start_token_id": 0,
|
| 7 |
+
"eos_token_id": 1,
|
| 8 |
+
"initializer_factor": 1.0,
|
| 9 |
+
"initializer_range": 0.02,
|
| 10 |
+
"is_encoder_decoder": true,
|
| 11 |
+
"is_vqa": false,
|
| 12 |
+
"model_type": "pix2struct",
|
| 13 |
+
"pad_token_id": 0,
|
| 14 |
+
"text_config": {
|
| 15 |
+
"dropout_rate": 0.2,
|
| 16 |
+
"encoder_hidden_size": 768,
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"model_type": "pix2struct_text_model"
|
| 19 |
+
},
|
| 20 |
+
"tie_word_embeddings": false,
|
| 21 |
+
"torch_dtype": "float32",
|
| 22 |
+
"transformers_version": "4.37.0.dev0",
|
| 23 |
+
"vision_config": {
|
| 24 |
+
"attention_dropout": 0.2,
|
| 25 |
+
"dropout_rate": 0.2,
|
| 26 |
+
"hidden_dropout_prob": 0.2,
|
| 27 |
+
"initializer_range": 0.02,
|
| 28 |
+
"layer_norm_bias": false,
|
| 29 |
+
"model_type": "pix2struct_vision_model",
|
| 30 |
+
"num_channels": 3,
|
| 31 |
+
"patch_size": 16,
|
| 32 |
+
"projection_dim": 768
|
| 33 |
+
}
|
| 34 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"decoder_start_token_id": 0,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.37.0.dev0",
|
| 7 |
+
"use_cache": false
|
| 8 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba064a402fb6905aabc37042b9f0dd1bd5ca94acd92d05ef8a1c829e6d94bd81
|
| 3 |
+
size 1129177976
|