Instructions to use adamjuhasz/gemma-vad-adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use adamjuhasz/gemma-vad-adapter with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-3-270m-it") model = PeftModel.from_pretrained(base_model, "adamjuhasz/gemma-vad-adapter") - Transformers
How to use adamjuhasz/gemma-vad-adapter with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="adamjuhasz/gemma-vad-adapter") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("adamjuhasz/gemma-vad-adapter", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use adamjuhasz/gemma-vad-adapter with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "adamjuhasz/gemma-vad-adapter" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "adamjuhasz/gemma-vad-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/adamjuhasz/gemma-vad-adapter
- SGLang
How to use adamjuhasz/gemma-vad-adapter 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 "adamjuhasz/gemma-vad-adapter" \ --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": "adamjuhasz/gemma-vad-adapter", "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 "adamjuhasz/gemma-vad-adapter" \ --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": "adamjuhasz/gemma-vad-adapter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use adamjuhasz/gemma-vad-adapter with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
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 adamjuhasz/gemma-vad-adapter to start chatting
Install Unsloth Studio (Windows)
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 adamjuhasz/gemma-vad-adapter to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for adamjuhasz/gemma-vad-adapter to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="adamjuhasz/gemma-vad-adapter", max_seq_length=2048, ) - Docker Model Runner
How to use adamjuhasz/gemma-vad-adapter with Docker Model Runner:
docker model run hf.co/adamjuhasz/gemma-vad-adapter
Gemma VAD Adapter
This is a text-based Voice Activity Detection model that determines if a given speech fragment is complete enough for processing by a smart speaker assistant. This allows smart speakers to move from using time based pauses (300ms - 1000ms) to detect the end of voice input to using this model to determine if the voice input is complete.
Example:
- "Hey" -> no
- "Hey Juno" -> no
- "Hey Juno can you" -> no
- "Hey Juno can you set" -> no
- "Hey Juno can you set the" -> no
- "Hey Juno can you set the temperature" -> no
- "Hey Juno can you set the temperature to" -> no
- "Hey Juno can you set the temperature to 65" -> yes
Model prompting requirements:
- Required system prompt: "You are a Voice Activity Detection system. Determine if the given speech fragment is complete enough for processing. Answer with only 'yes' if complete or 'no' if incomplete."
- Required user prompt: "Is this sentence fragment complete for processing: '{fragment}'"
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
from peft import PeftModel
BASE_ID = "unsloth/gemma-3-270m-it"
ADAPTER_ID = "adamjuhasz/gemma-vad-adapter"
# 1) Load base + attach LoRA
model = AutoModelForCausalLM.from_pretrained(
BASE_ID,
torch_dtype=torch.float32, # use float32 on CPU/MPS; bfloat16 on CUDA if you like
device_map="auto", # picks GPU/MPS if available
)
model = PeftModel.from_pretrained(model, ADAPTER_ID)
model.eval()
# 2) Tokenizer (from the base)
tokenizer = AutoTokenizer.from_pretrained(BASE_ID, use_fast=True)
tokenizer.padding_side = "left"
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
# 3) Build a chat prompt using the model’s chat template
messages = [
{
"role": "system",
"content": "You are a Voice Activity Detection system. Determine if the given speech fragment is complete enough for processing. Answer with only 'yes' if complete or 'no' if incomplete.",
},
{
"role": "user",
"content": "Is this sentence fragment complete for processing: 'Set the temperature'",
},
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
# 4A) Raw generate()
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
gen = model.generate(
**inputs,
max_new_tokens=1,
do_sample=False, # greedy
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
print(
tokenizer.decode(gen[0][inputs["input_ids"].shape[1] :], skip_special_tokens=True)
)
# 4B) Or use pipeline("text-generation") — pass the rendered string, not the messages list
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, device_map="auto")
print(pipe(prompt)[0]["generated_text"])
Framework versions
- PEFT 0.17.1
- Downloads last month
- -