Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

GorankLabs
/
Ranker-Gemma-4B

Image-Text-to-Text
Transformers
Safetensors
PEFT
English
gemma3
lora
search
retrieval
grounded-generation
question-answering
ranker
conversational
text-generation-inference
Model card Files Files and versions
xet
Community

Instructions to use GorankLabs/Ranker-Gemma-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use GorankLabs/Ranker-Gemma-4B with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("image-text-to-text", model="GorankLabs/Ranker-Gemma-4B")
    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 AutoProcessor, AutoModelForMultimodalLM
    
    processor = AutoProcessor.from_pretrained("GorankLabs/Ranker-Gemma-4B")
    model = AutoModelForMultimodalLM.from_pretrained("GorankLabs/Ranker-Gemma-4B")
    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?"}
            ]
        },
    ]
    inputs = processor.apply_chat_template(
    	messages,
    	add_generation_prompt=True,
    	tokenize=True,
    	return_dict=True,
    	return_tensors="pt",
    ).to(model.device)
    
    outputs = model.generate(**inputs, max_new_tokens=40)
    print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
  • PEFT

    How to use GorankLabs/Ranker-Gemma-4B with PEFT:

    Task type is invalid.
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps Settings
  • vLLM

    How to use GorankLabs/Ranker-Gemma-4B with vLLM:

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

    How to use GorankLabs/Ranker-Gemma-4B 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 "GorankLabs/Ranker-Gemma-4B" \
        --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": "GorankLabs/Ranker-Gemma-4B",
    		"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 "GorankLabs/Ranker-Gemma-4B" \
            --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": "GorankLabs/Ranker-Gemma-4B",
    		"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 GorankLabs/Ranker-Gemma-4B with Docker Model Runner:

    docker model run hf.co/GorankLabs/Ranker-Gemma-4B
Ranker-Gemma-4B
99.2 MB
Ctrl+K
Ctrl+K
  • 2 contributors
History: 12 commits
Ill-Ness's picture
Ill-Ness
Update README.md
2763247 verified 3 months ago
  • .gitattributes
    1.57 kB
    Update .gitattributes 3 months ago
  • LICENSE
    666 Bytes
    Update LICENSE 3 months ago
  • README.md
    5.06 kB
    Update README.md 3 months ago
  • adapter_config.json
    1.13 kB
    Upload folder using huggingface_hub 3 months ago
  • adapter_model.safetensors
    65.7 MB
    xet
    Upload folder using huggingface_hub 3 months ago
  • chat_template.jinja
    4.74 kB
    Upload folder using huggingface_hub 3 months ago
  • citation_schema.json
    504 Bytes
    Upload folder using huggingface_hub 3 months ago
  • config.json
    1.35 kB
    Upload folder using huggingface_hub 3 months ago
  • generation_config.json
    134 Bytes
    Upload folder using huggingface_hub 3 months ago
  • gitattributes
    1.64 kB
    Upload folder using huggingface_hub 3 months ago
  • model.safetensors.index.json
    76.2 kB
    Upload folder using huggingface_hub 3 months ago
  • processor_config.json
    43 Bytes
    Upload folder using huggingface_hub 3 months ago
  • retrieval_template.jinja
    1.1 kB
    Upload folder using huggingface_hub 3 months ago
  • search_config.json
    1.27 kB
    Upload folder using huggingface_hub 3 months ago
  • search_results.example.json
    931 Bytes
    Upload folder using huggingface_hub 3 months ago
  • tokenizer.json
    33.4 MB
    xet
    Upload folder using huggingface_hub 3 months ago
  • tokenizer_config.json
    5.74 kB
    Upload folder using huggingface_hub 3 months ago