Run this model with HF Jobs
Run anthonym21/pinescript-v5-instructions-merged on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/anthonym21/pinescript-v5-instructions-merged. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/anthonym21/pinescript-v5-instructions-merged on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/anthonym21/pinescript-v5-instructions-merged. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/anthonym21/pinescript-v5-instructions-merged. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use anthonym21/pinescript-v5-instructions-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use anthonym21/pinescript-v5-instructions-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="anthonym21/pinescript-v5-instructions-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("anthonym21/pinescript-v5-instructions-merged") model = AutoModelForCausalLM.from_pretrained("anthonym21/pinescript-v5-instructions-merged", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use anthonym21/pinescript-v5-instructions-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "anthonym21/pinescript-v5-instructions-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anthonym21/pinescript-v5-instructions-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/anthonym21/pinescript-v5-instructions-merged
- SGLang
How to use anthonym21/pinescript-v5-instructions-merged 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 "anthonym21/pinescript-v5-instructions-merged" \ --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": "anthonym21/pinescript-v5-instructions-merged", "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 "anthonym21/pinescript-v5-instructions-merged" \ --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": "anthonym21/pinescript-v5-instructions-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use anthonym21/pinescript-v5-instructions-merged with Docker Model Runner:
docker model run hf.co/anthonym21/pinescript-v5-instructions-merged
Use Docker
docker model run hf.co/anthonym21/pinescript-v5-instructions-mergedPineScript v5 Code Generator
A fine-tuned CodeGemma 7B model specialized in generating TradingView PineScript v5 code for trading indicators, strategies, and libraries.
Model Description
This model was fine-tuned on 5,000+ PineScript v5 examples from the PineScripts-Permissive dataset, which contains high-quality, permissively-licensed scripts from TradingView.
- Base Model: google/codegemma-7b-it
- Fine-tuning Method: QLoRA (4-bit quantization + LoRA adapters)
- Training Data: 4,774 instruction/response pairs
- Context Length: 4096 tokens
Intended Use
Generate PineScript v5 code for:
- Technical indicators (RSI, MACD, Bollinger Bands, custom indicators)
- Trading strategies with backtesting
- Reusable libraries
- Alert conditions
- Custom visualizations
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "anthonym21/pinescript-v5-instructions-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
def generate_pinescript(prompt, max_tokens=1024):
formatted = f"### Human: {prompt}\n### Assistant:"
inputs = tokenizer(formatted, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=max_tokens,
temperature=0.7,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response.split("### Assistant:")[-1].strip()
# Example
code = generate_pinescript("Write a PineScript v5 RSI indicator with overbought/oversold zones")
print(code)
Example Prompts
| Prompt | Description |
|---|---|
| "Write a PineScript v5 indicator that shows RSI with dynamic overbought/oversold levels" | RSI with adaptive levels |
| "Create a MACD crossover strategy with stop loss and take profit" | Complete trading strategy |
| "Write a Bollinger Bands indicator with squeeze detection" | Volatility indicator |
| "Create a multi-timeframe moving average indicator" | MTF analysis tool |
Training Details
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Batch Size | 2 |
| Gradient Accumulation | 8 |
| Learning Rate | 2e-4 |
| LoRA r | 64 |
| LoRA alpha | 128 |
| Max Seq Length | 4096 |
| Quantization | 4-bit (nf4) |
Limitations
- Generates PineScript v5 syntax; may not be compatible with older versions
- Code should be reviewed and tested before live trading
- Complex multi-indicator strategies may require refinement
- Does not provide financial advice
Dataset
Training data sourced from mrmegatelo/PineScripts-Permissive:
- 5,848 PineScript v5 scripts
- Filtered to 4,774 high-quality examples
- Includes indicators, strategies, and libraries
- All scripts under permissive licenses (MPL-2.0, Apache-2.0)
Citation
@misc{pinescript-v5-instructions-merged,
author = {Anthony Maio},
title = {PineScript v5 Code Generator},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/anthonym21/pinescript-v5-instructions-merged}
}
License
Apache 2.0 (same as base model)
- Downloads last month
- 139
Model tree for anthonym21/pinescript-v5-instructions-merged
Base model
google/codegemma-7b-it
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "anthonym21/pinescript-v5-instructions-merged"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anthonym21/pinescript-v5-instructions-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'