Text Generation
Transformers
Safetensors
gemma4
image-text-to-text
mobile-actions
function-calling
tool-use
trl
lora
conversational
Instructions to use ClarkBear/gemma4-e2b-mobile-actions-200 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ClarkBear/gemma4-e2b-mobile-actions-200 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ClarkBear/gemma4-e2b-mobile-actions-200") 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("ClarkBear/gemma4-e2b-mobile-actions-200") model = AutoModelForMultimodalLM.from_pretrained("ClarkBear/gemma4-e2b-mobile-actions-200", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ClarkBear/gemma4-e2b-mobile-actions-200 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ClarkBear/gemma4-e2b-mobile-actions-200" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ClarkBear/gemma4-e2b-mobile-actions-200", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ClarkBear/gemma4-e2b-mobile-actions-200
- SGLang
How to use ClarkBear/gemma4-e2b-mobile-actions-200 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 "ClarkBear/gemma4-e2b-mobile-actions-200" \ --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": "ClarkBear/gemma4-e2b-mobile-actions-200", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "ClarkBear/gemma4-e2b-mobile-actions-200" \ --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": "ClarkBear/gemma4-e2b-mobile-actions-200", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ClarkBear/gemma4-e2b-mobile-actions-200 with Docker Model Runner:
docker model run hf.co/ClarkBear/gemma4-e2b-mobile-actions-200
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -133,6 +133,18 @@ generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
| 133 |
print(generator(prompt, max_new_tokens=160, do_sample=False)[0]["generated_text"])
|
| 134 |
```
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
## Limitations
|
| 137 |
|
| 138 |
This is an experimental small-data fine-tune.
|
|
|
|
| 133 |
print(generator(prompt, max_new_tokens=160, do_sample=False)[0]["generated_text"])
|
| 134 |
```
|
| 135 |
|
| 136 |
+
## Examples
|
| 137 |
+
|
| 138 |
+
This repository includes runnable examples:
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
python examples/run_transformers.py \
|
| 142 |
+
--model-id ClarkBear/gemma4-e2b-mobile-actions-200 \
|
| 143 |
+
--prompt "Turn on the flashlight"
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
Example prompts are available in `examples/prompts.jsonl`.
|
| 147 |
+
|
| 148 |
## Limitations
|
| 149 |
|
| 150 |
This is an experimental small-data fine-tune.
|