Instructions to use philippotiger/forecast-extractor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use philippotiger/forecast-extractor with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf philippotiger/forecast-extractor:F16 # Run inference directly in the terminal: llama cli -hf philippotiger/forecast-extractor:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf philippotiger/forecast-extractor:F16 # Run inference directly in the terminal: llama cli -hf philippotiger/forecast-extractor:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf philippotiger/forecast-extractor:F16 # Run inference directly in the terminal: ./llama-cli -hf philippotiger/forecast-extractor:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf philippotiger/forecast-extractor:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf philippotiger/forecast-extractor:F16
Use Docker
docker model run hf.co/philippotiger/forecast-extractor:F16
- LM Studio
- Jan
- vLLM
How to use philippotiger/forecast-extractor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "philippotiger/forecast-extractor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "philippotiger/forecast-extractor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/philippotiger/forecast-extractor:F16
- Ollama
How to use philippotiger/forecast-extractor with Ollama:
ollama run hf.co/philippotiger/forecast-extractor:F16
- Unsloth Studio
How to use philippotiger/forecast-extractor 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 philippotiger/forecast-extractor 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 philippotiger/forecast-extractor to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for philippotiger/forecast-extractor to start chatting
- Pi
How to use philippotiger/forecast-extractor with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf philippotiger/forecast-extractor:F16
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "philippotiger/forecast-extractor:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use philippotiger/forecast-extractor with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf philippotiger/forecast-extractor:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "philippotiger/forecast-extractor:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use philippotiger/forecast-extractor with Docker Model Runner:
docker model run hf.co/philippotiger/forecast-extractor:F16
- Lemonade
How to use philippotiger/forecast-extractor with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull philippotiger/forecast-extractor:F16
Run and chat with the model
lemonade run user.forecast-extractor-F16
List all available models
lemonade list
- Hermes Agent
How to use philippotiger/forecast-extractor with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf philippotiger/forecast-extractor:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default philippotiger/forecast-extractor:F16
Run Hermes
hermes
- Atomic Chat
Upload train.py with huggingface_hub
Browse files
train.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Fine-tuning Qwen2.5-3B-Instruct for football prediction extraction
|
| 3 |
+
Fixes from original: target_modules, validation split, scheduler, checkpoint saving
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from datasets import load_dataset
|
| 7 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, BitsAndBytesConfig
|
| 8 |
+
from peft import LoraConfig
|
| 9 |
+
from trl import SFTTrainer, DataCollatorForCompletionOnlyLM
|
| 10 |
+
import torch
|
| 11 |
+
|
| 12 |
+
# ─────────────────────────────────────────────
|
| 13 |
+
# CONFIG
|
| 14 |
+
# ─────────────────────────────────────────────
|
| 15 |
+
MODEL_NAME = "Qwen/Qwen2.5-3B-Instruct"
|
| 16 |
+
OUTPUT_DIR = "./football-extractor"
|
| 17 |
+
TRAIN_FILE = "train_dataset.jsonl"
|
| 18 |
+
VAL_FILE = "val_dataset.jsonl"
|
| 19 |
+
|
| 20 |
+
# ─────────────────────────────────────────────
|
| 21 |
+
# LOAD DATA
|
| 22 |
+
# ─────────────────────────────────────────────
|
| 23 |
+
dataset = load_dataset("json", data_files={"train": TRAIN_FILE, "validation": VAL_FILE})
|
| 24 |
+
print(f"Train: {len(dataset['train'])} | Val: {len(dataset['validation'])}")
|
| 25 |
+
|
| 26 |
+
# ─────────────────────────────────────────────
|
| 27 |
+
# TOKENIZER
|
| 28 |
+
# ─────────────────────────────────────────────
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
| 30 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 31 |
+
tokenizer.padding_side = "right" # important for causal LM training
|
| 32 |
+
|
| 33 |
+
# ─────────────────────────────────────────────
|
| 34 |
+
# QUANTIZATION (4-bit QLoRA)
|
| 35 |
+
# ─────────────────────────────────────────────
|
| 36 |
+
bnb_config = BitsAndBytesConfig(
|
| 37 |
+
load_in_4bit=True,
|
| 38 |
+
bnb_4bit_quant_type="nf4",
|
| 39 |
+
bnb_4bit_compute_dtype=torch.bfloat16, # bfloat16 is more stable than float16
|
| 40 |
+
bnb_4bit_use_double_quant=True, # saves a bit more VRAM
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 44 |
+
MODEL_NAME,
|
| 45 |
+
quantization_config=bnb_config,
|
| 46 |
+
device_map="auto",
|
| 47 |
+
attn_implementation="eager", # avoids flash-attn issues on Colab
|
| 48 |
+
)
|
| 49 |
+
model.config.use_cache = False # required for gradient checkpointing
|
| 50 |
+
|
| 51 |
+
# ─────────────────────────────────────────────
|
| 52 |
+
# LORA CONFIG
|
| 53 |
+
# ─────────────────────────────────────────────
|
| 54 |
+
lora_config = LoraConfig(
|
| 55 |
+
r=8, # smaller r is fine for simple extraction
|
| 56 |
+
lora_alpha=16,
|
| 57 |
+
lora_dropout=0.05,
|
| 58 |
+
bias="none",
|
| 59 |
+
task_type="CAUSAL_LM",
|
| 60 |
+
# Explicitly target attention + MLP layers for Qwen2.5
|
| 61 |
+
target_modules=[
|
| 62 |
+
"q_proj", "k_proj", "v_proj", "o_proj",
|
| 63 |
+
"gate_proj", "up_proj", "down_proj"
|
| 64 |
+
],
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
# ─────────────────────────────────────────────
|
| 68 |
+
# FORMAT FUNCTION
|
| 69 |
+
# ─────────────────────────────────────────────
|
| 70 |
+
def format_example(example):
|
| 71 |
+
"""Apply Qwen2.5 chat template to each training example."""
|
| 72 |
+
return tokenizer.apply_chat_template(
|
| 73 |
+
example["messages"],
|
| 74 |
+
tokenize=False,
|
| 75 |
+
add_generation_prompt=False
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
# ─────────────────────────────────────────────
|
| 79 |
+
# TRAINING ARGS
|
| 80 |
+
# ─────────────────────────────────────────────
|
| 81 |
+
training_args = TrainingArguments(
|
| 82 |
+
output_dir=OUTPUT_DIR,
|
| 83 |
+
per_device_train_batch_size=1,
|
| 84 |
+
gradient_accumulation_steps=4, # effective batch = 4
|
| 85 |
+
gradient_checkpointing=True, # saves VRAM
|
| 86 |
+
learning_rate=2e-4,
|
| 87 |
+
num_train_epochs=3,
|
| 88 |
+
lr_scheduler_type="cosine", # smooth decay
|
| 89 |
+
warmup_ratio=0.05, # 5% warmup steps
|
| 90 |
+
logging_steps=10,
|
| 91 |
+
eval_strategy="epoch", # evaluate after each epoch
|
| 92 |
+
save_strategy="epoch", # save checkpoint each epoch
|
| 93 |
+
save_total_limit=2, # keep only last 2 checkpoints
|
| 94 |
+
load_best_model_at_end=True,
|
| 95 |
+
metric_for_best_model="eval_loss",
|
| 96 |
+
fp16=False,
|
| 97 |
+
bf16=True, # use bfloat16 if your GPU supports it
|
| 98 |
+
report_to="none", # set to "wandb" if you want tracking
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
# ────────────────────────────���────────────────
|
| 102 |
+
# TRAINER
|
| 103 |
+
# ─────────────────────────────────────────────
|
| 104 |
+
trainer = SFTTrainer(
|
| 105 |
+
model=model,
|
| 106 |
+
train_dataset=dataset["train"],
|
| 107 |
+
eval_dataset=dataset["validation"],
|
| 108 |
+
peft_config=lora_config,
|
| 109 |
+
args=training_args,
|
| 110 |
+
formatting_func=format_example,
|
| 111 |
+
max_seq_length=512, # extraction tasks are short
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
trainer.train()
|
| 115 |
+
trainer.save_model(OUTPUT_DIR)
|
| 116 |
+
tokenizer.save_pretrained(OUTPUT_DIR)
|
| 117 |
+
print(f"✅ Adapter saved to {OUTPUT_DIR}")
|