Instructions to use TienAnh/Finetune_OCR_1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TienAnh/Finetune_OCR_1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TienAnh/Finetune_OCR_1B", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TienAnh/Finetune_OCR_1B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TienAnh/Finetune_OCR_1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TienAnh/Finetune_OCR_1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TienAnh/Finetune_OCR_1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/TienAnh/Finetune_OCR_1B
- SGLang
How to use TienAnh/Finetune_OCR_1B 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 "TienAnh/Finetune_OCR_1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TienAnh/Finetune_OCR_1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "TienAnh/Finetune_OCR_1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TienAnh/Finetune_OCR_1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use TienAnh/Finetune_OCR_1B with Docker Model Runner:
docker model run hf.co/TienAnh/Finetune_OCR_1B
Bạn có thể chỉ cách để finetune từ Vintern-1B-3.5 ?
Hi bạn.
Mình đã thử để finetune Vintern-1B-3.5 để ra mô hình như bạn nhưng vẫn bị thất bại vì flash-attn( thử nhìu cách như đổi config, tìm cách cài flash-attn...). Không biết bạn coa thể chỉ mình cách để xử lý không. Cảm ơn bạn rất nhiều, một số nội dung mình cần hỏi:
1/ môi trường : Colab phải không ạ.
2/ bạn có cài lại torch và cuda không ạ
3/ bạn cìa flash-attn bằng cách nào ạ? Hoặc vô hiệu fash-attn như thế nào.
Cảm ơn bạn rất nhiều, thông tin của bạn sẽ giúp mình rất nhiều thời gian và công sức mày mò ạ
mình finetune ở kaggle á, đợt mình có thử colab thì vẫn ok á. Mình k có xài flash-attn ạ. Nếu được thì bạn nhắn tin riêng cho mình cho tiện trao đổi nhé , thông tin liên hệ chắc bạn vào đây https://github.com/HTAnh2003 nhé. Mình sợ gửi sdt zalo lên đây k tiện.