Instructions to use jadechoghari/Ferret-UI-Gemma2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jadechoghari/Ferret-UI-Gemma2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="jadechoghari/Ferret-UI-Gemma2b", 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("jadechoghari/Ferret-UI-Gemma2b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jadechoghari/Ferret-UI-Gemma2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jadechoghari/Ferret-UI-Gemma2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jadechoghari/Ferret-UI-Gemma2b", "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/jadechoghari/Ferret-UI-Gemma2b
- SGLang
How to use jadechoghari/Ferret-UI-Gemma2b 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 "jadechoghari/Ferret-UI-Gemma2b" \ --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": "jadechoghari/Ferret-UI-Gemma2b", "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 "jadechoghari/Ferret-UI-Gemma2b" \ --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": "jadechoghari/Ferret-UI-Gemma2b", "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 jadechoghari/Ferret-UI-Gemma2b with Docker Model Runner:
docker model run hf.co/jadechoghari/Ferret-UI-Gemma2b
How to use it in local development environment?
I want to download this mode and test it in my local environment, do you have some usage tutorial to help me use it ? thanks.
Hey!
I think the code provided in the documentation is straightforward; however, there’s a nice tutorial you can also follow here: https://www.youtube.com/watch?v=vSsb20uxCD8
me too,I have a mac
is the youtube video not clear ? :) @chenliangjing
Thanks for sharing the video! I'm a mobile app developer working on macOS and new to AI. I'm trying to implement this model for automated testing, specifically for screen perception in our testing workflow. However, I'm having some trouble getting it running successfully on my Mac - could you clarify if there are any specific configurations or setup steps needed for macOS?
As an AI beginner, I'd really appreciate any additional guidance or tips you could share. Looking forward to your response!
Best regards"