|
|
--- |
|
|
license: gemma |
|
|
library_name: transformers |
|
|
tags: |
|
|
- gemma |
|
|
- video-production |
|
|
- automation |
|
|
- viral-content |
|
|
- function-calling |
|
|
base_model: google/functiongemma-270m-it |
|
|
pipeline_tag: text-generation |
|
|
--- |
|
|
|
|
|
# ๐ฌ 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 |
|
|
|
|
|
```python |
|
|
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] |