Instructions to use Paulwalker4884/gemma-3-1b-terminal-assistant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Paulwalker4884/gemma-3-1b-terminal-assistant with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Paulwalker4884/gemma-3-1b-terminal-assistant") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Paulwalker4884/gemma-3-1b-terminal-assistant") model = AutoModelForCausalLM.from_pretrained("Paulwalker4884/gemma-3-1b-terminal-assistant", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Paulwalker4884/gemma-3-1b-terminal-assistant with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Paulwalker4884/gemma-3-1b-terminal-assistant" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Paulwalker4884/gemma-3-1b-terminal-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Paulwalker4884/gemma-3-1b-terminal-assistant
- SGLang
How to use Paulwalker4884/gemma-3-1b-terminal-assistant 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 "Paulwalker4884/gemma-3-1b-terminal-assistant" \ --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": "Paulwalker4884/gemma-3-1b-terminal-assistant", "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 "Paulwalker4884/gemma-3-1b-terminal-assistant" \ --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": "Paulwalker4884/gemma-3-1b-terminal-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Paulwalker4884/gemma-3-1b-terminal-assistant with Docker Model Runner:
docker model run hf.co/Paulwalker4884/gemma-3-1b-terminal-assistant
Gemma 3 1B Terminal Assistant
A fine-tuned version of Google's Gemma 3 1B Instruction Tuned model specialized for terminal command generation.
This model was trained to understand natural language requests and generate safe, minimal terminal commands.
Model Details
Base Model:
- google/gemma-3-1b-it
Fine-tuning Method:
- Supervised Fine-Tuning (SFT)
- Mica fine-tuning
- Mica merged into the base model
Training Dataset:
- mshojaei77/terminal-command-execution-sft
Task:
- Linux terminal commands
- Windows commands
- Shell scripting
- Command explanation
- Safe command generation
Example Usage
Python Example
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_name = "Paulwalker4884/gemma-3-1b-terminal-assistant"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
messages = [
{
"role": "system",
"content": "You are a safe terminal command assistant."
},
{
"role": "user",
"content": "Find all python files recursively"
}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=128,
temperature=0.2
)
response = tokenizer.decode(
outputs[0][inputs.shape[-1]:],
skip_special_tokens=True
)
print(response)
Example
Input:
Find all python files recursively
Output:
find . -name "*.py"
Input:
Find all log files modified in the last 7 days and save them
Output:
find . -name "*.log" -mtime -7 > recent_logs.txt
Safety
This model is trained to avoid blindly generating destructive commands.
For potentially dangerous operations, users should verify commands before execution.
Limitations
- The model may generate incorrect commands.
- Always review generated commands before running them.
- Performance depends on the quality of the input prompt.
Training Information
Dataset size:
- Train: 31,429 examples
- Evaluation: 239 examples
Frameworks:
- Transformers
- TRL
- PEFT
- PyTorch
BY : Yasin Keykha
- Downloads last month
- 413