Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

mobenta
/
Gemma2-9B

Image-Text-to-Text
Transformers
Safetensors
ovis
text-generation
MLLM
conversational
custom_code
Model card Files Files and versions
xet
Community

Instructions to use mobenta/Gemma2-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use mobenta/Gemma2-9B with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("image-text-to-text", model="mobenta/Gemma2-9B", 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("mobenta/Gemma2-9B", trust_remote_code=True, dtype="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • vLLM

    How to use mobenta/Gemma2-9B with vLLM:

    Install from pip and serve model
    # Install vLLM from pip:
    pip install vllm
    # Start the vLLM server:
    vllm serve "mobenta/Gemma2-9B"
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:8000/v1/chat/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "mobenta/Gemma2-9B",
    		"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/mobenta/Gemma2-9B
  • SGLang

    How to use mobenta/Gemma2-9B 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 "mobenta/Gemma2-9B" \
        --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": "mobenta/Gemma2-9B",
    		"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 "mobenta/Gemma2-9B" \
            --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": "mobenta/Gemma2-9B",
    		"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 mobenta/Gemma2-9B with Docker Model Runner:

    docker model run hf.co/mobenta/Gemma2-9B
Gemma2-9B
Ctrl+K
Ctrl+K
  • 1 contributor
History: 6 commits
mobenta's picture
mobenta
Update README.md
8be94cc verified over 1 year ago
  • .gitattributes
    1.57 kB
    Upload 12 files over 1 year ago
  • README.md
    4.41 kB
    Update README.md over 1 year ago
  • config.json
    6.94 kB
    Upload 12 files over 1 year ago
  • configuration_ovis.py
    8.19 kB
    Upload 12 files over 1 year ago
  • generation_config.json
    187 Bytes
    Upload 12 files over 1 year ago
  • gitattributes
    1.57 kB
    Upload 12 files over 1 year ago
  • model-00001-of-00005.safetensors
    4.9 GB
    xet
    Upload 5 files over 1 year ago
  • model-00002-of-00005.safetensors
    4.95 GB
    xet
    Upload 5 files over 1 year ago
  • model-00003-of-00005.safetensors
    4.96 GB
    xet
    Upload 5 files over 1 year ago
  • model-00004-of-00005.safetensors
    4.53 GB
    xet
    Upload 5 files over 1 year ago
  • model-00005-of-00005.safetensors
    1.07 GB
    xet
    Upload 5 files over 1 year ago
  • model.safetensors.index.json
    94.5 kB
    Upload 12 files over 1 year ago
  • modeling_ovis.py
    28.8 kB
    Upload 12 files over 1 year ago
  • preprocessor_config.json
    394 Bytes
    Upload 12 files over 1 year ago
  • special_tokens_map.json
    636 Bytes
    Upload 12 files over 1 year ago
  • tokenizer.json
    17.5 MB
    xet
    Upload 12 files over 1 year ago
  • tokenizer.model
    4.24 MB
    xet
    Upload 12 files over 1 year ago
  • tokenizer_config.json
    40.6 kB
    Upload 12 files over 1 year ago