Image-Text-to-Text
Transformers
PEFT
sft
trl
qlora
kyc
document-extraction
document-classification
aadhaar
pan-card
passport
visa
election-card
gemma4
vision-language-model
vllm
Instructions to use Jwalit/gemma4-e4b-kyc-document-extractor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jwalit/gemma4-e4b-kyc-document-extractor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Jwalit/gemma4-e4b-kyc-document-extractor")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Jwalit/gemma4-e4b-kyc-document-extractor", dtype="auto") - PEFT
How to use Jwalit/gemma4-e4b-kyc-document-extractor with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Jwalit/gemma4-e4b-kyc-document-extractor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Jwalit/gemma4-e4b-kyc-document-extractor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jwalit/gemma4-e4b-kyc-document-extractor", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Jwalit/gemma4-e4b-kyc-document-extractor
- SGLang
How to use Jwalit/gemma4-e4b-kyc-document-extractor 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 "Jwalit/gemma4-e4b-kyc-document-extractor" \ --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": "Jwalit/gemma4-e4b-kyc-document-extractor", "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 "Jwalit/gemma4-e4b-kyc-document-extractor" \ --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": "Jwalit/gemma4-e4b-kyc-document-extractor", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Jwalit/gemma4-e4b-kyc-document-extractor with Docker Model Runner:
docker model run hf.co/Jwalit/gemma4-e4b-kyc-document-extractor
Add dataset generation script reference
Browse files- generate_kyc_dataset.py +20 -0
generate_kyc_dataset.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Generate a synthetic KYC document dataset for training a VLM on document
|
| 3 |
+
extraction and classification tasks.
|
| 4 |
+
|
| 5 |
+
Produces document images for: Aadhar, PAN, Passport, Visa, Election Card
|
| 6 |
+
with corresponding extraction ground truth in JSON format.
|
| 7 |
+
|
| 8 |
+
Usage:
|
| 9 |
+
pip install datasets Pillow faker huggingface_hub
|
| 10 |
+
python generate_kyc_dataset.py
|
| 11 |
+
|
| 12 |
+
Output: Pushes to HuggingFace Hub as Jwalit/kyc-document-extraction-vlm
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
# See full script at: https://huggingface.co/datasets/Jwalit/kyc-document-extraction-vlm
|
| 16 |
+
# The dataset has already been generated and pushed.
|
| 17 |
+
# Re-run this script only if you want to regenerate with different parameters.
|
| 18 |
+
|
| 19 |
+
print("Dataset already generated at: https://huggingface.co/datasets/Jwalit/kyc-document-extraction-vlm")
|
| 20 |
+
print("To regenerate, uncomment the code below and run.")
|