chimbiwide/RolePlay-NPC
Viewer • Updated • 18.6k • 40 • 8
How to use chimbiwide/Gemma3NPC-it-beta with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="chimbiwide/Gemma3NPC-it-beta")
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("chimbiwide/Gemma3NPC-it-beta")
model = AutoModelForMultimodalLM.from_pretrained("chimbiwide/Gemma3NPC-it-beta", 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]:]))How to use chimbiwide/Gemma3NPC-it-beta with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "chimbiwide/Gemma3NPC-it-beta"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "chimbiwide/Gemma3NPC-it-beta",
"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 run hf.co/chimbiwide/Gemma3NPC-it-beta
How to use chimbiwide/Gemma3NPC-it-beta with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "chimbiwide/Gemma3NPC-it-beta" \
--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": "chimbiwide/Gemma3NPC-it-beta",
"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 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 "chimbiwide/Gemma3NPC-it-beta" \
--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": "chimbiwide/Gemma3NPC-it-beta",
"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"
}
}
]
}
]
}'How to use chimbiwide/Gemma3NPC-it-beta with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for chimbiwide/Gemma3NPC-it-beta to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for chimbiwide/Gemma3NPC-it-beta to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for chimbiwide/Gemma3NPC-it-beta to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="chimbiwide/Gemma3NPC-it-beta",
max_seq_length=2048,
)How to use chimbiwide/Gemma3NPC-it-beta with Docker Model Runner:
docker model run hf.co/chimbiwide/Gemma3NPC-it-beta
As mentioned in our original article, we employed a very conservative training parameters for Gemma3NPC
Ever since then, we have always wanted to test the performance of the model when we make the training parameters less conservative.
So we present Gemma3NPC-it-beta.
Check out our training notebook here
Gemma3NPC-it
| Parameter | Gemma3NPC-it | Gemma3NPC-it-beta |
|---|---|---|
| Learning Rate | 2e-5 | 2.5e-5 (+25%) |
| Warmup Steps | 800 | 100 |
| gradient clipping | 0.4 | 1.0 |
Here is a graph of the Step Training Loss, saved every 10 steps: