Text Generation
Transformers
TensorBoard
Safetensors
gemma3_text
gemma
video-production
automation
viral-content
function-calling
conversational
text-generation-inference
Instructions to use Saad4web/FunctionGemma-Director-V1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Saad4web/FunctionGemma-Director-V1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Saad4web/FunctionGemma-Director-V1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Saad4web/FunctionGemma-Director-V1") model = AutoModelForCausalLM.from_pretrained("Saad4web/FunctionGemma-Director-V1") 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
- vLLM
How to use Saad4web/FunctionGemma-Director-V1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Saad4web/FunctionGemma-Director-V1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Saad4web/FunctionGemma-Director-V1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Saad4web/FunctionGemma-Director-V1
- SGLang
How to use Saad4web/FunctionGemma-Director-V1 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 "Saad4web/FunctionGemma-Director-V1" \ --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": "Saad4web/FunctionGemma-Director-V1", "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 "Saad4web/FunctionGemma-Director-V1" \ --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": "Saad4web/FunctionGemma-Director-V1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Saad4web/FunctionGemma-Director-V1 with Docker Model Runner:
docker model run hf.co/Saad4web/FunctionGemma-Director-V1
🎬 FunctionGemma-Director-V1
FunctionGemma-Director-V1 is a specialized lightweight AI model (270M parameters) designed to automate the production of viral short-form gaming videos (TikTok/Shorts/Reels).
It acts as a "Creative Director", converting a simple video title into a structured JSON editing plan, executing a "Trojan Horse" monetization strategy by seamlessly integrating CPA offers into content.
🚀 Key Features
- Size: ~540MB (Runs smoothly on free Colab/CPU).
- Strategy: Automatically places "High Retention Hooks" and injects "CPA Offers" at the most effective timestamps.
- Output: Strict JSON format compatible with Python video automation engines (MoviePy).
💻 How to Use
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import json
# 1. Load the Model
model_id = "Saad4web/FunctionGemma-Director-V1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.float16 # Optimized for low memory
)
# 2. Define the Tools (The Model's Vocabulary)
tools_schema = [
{"name": "add_video_clip", "parameters": {"file_path": "string", "duration": "number"}},
{"name": "add_text_overlay", "parameters": {"text": "string", "color": "string"}},
]
# 3. Create the Prompt
video_title = "TOP 3|SCARIEST HORROR GAMES|*DONT WATCH ALONE*"
system_msg = f"You are a specialized video editor AI. Available tools: {json.dumps(tools_schema)}"
messages = [{"role": "user", "content": system_msg + f"\n\nCreate a viral video plan for: {video_title}"}]
# 4. Generate the Plan
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(
input_ids,
max_new_tokens=512,
do_sample=True,
temperature=0.1
)
# 5. Get the JSON
plan = tokenizer.decode(outputs[0][len(input_ids[0]):], skip_special_tokens=True)
print(plan)
#🛠️ Training Details
Architecture: Fine-tuned google/functiongemma-270m-it.
Dataset: Synthetic dataset generated via Knowledge Distillation (Teacher: GPT-4o/Gemini 2.0).
Method: Full Fine-Tuning using LLaMA Factory.
Created by [Saad4web]
- Downloads last month
- 3