GPT-OSS 20B Trading Policy LoRA Adapter (jun47/gpt-oss-20b-trading)

This repository contains the PEFT LoRA adapter weights trained on top of the openai/gpt-oss-20b base model. The model is specifically fine-tuned for automated stock trading policy formulation and financial analysis.

By releasing only the LoRA adapter (~15.9 MB), we ensure extreme efficiency in storage and memory footprint. This modular design allows users to load the unified base model in memory and hot-swap adapters dynamically.

Model Details

  • Base Model: openai/gpt-oss-20b
  • Adapter Type: LoRA (Parameter-Efficient Fine-Tuning)
  • Target Modules: q_proj, v_proj (Self-Attention layers only to optimize VRAM and prevent expert interference)
  • LoRA Hyperparameters:
    • Rank (r): 16
    • Alpha (lora_alpha): 32
    • Dropout: 0.1
    • Task Type: CAUSAL_LM

How to Load and Use (Inference)

You can easily load this adapter on top of the base 20B model using Hugging Face transformers and peft:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_model_id = "openai/gpt-oss-20b"
adapter_model_id = "jun47/gpt-oss-20b-trading"

print("📥 Loading base model and tokenizer...")
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    device_map="auto",
    torch_dtype=torch.float16,
    load_in_8bit=True # Optional: use 8-bit quantization for lower VRAM
)

print("📥 Merging LoRA adapter weights...")
model = PeftModel.from_pretrained(model, adapter_model_id)
model.eval()

print("🚀 Running Inference...")
prompt = "Analyze the AAPL stock trend under the current VIX surge and suggest a trading policy:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=256,
        temperature=0.7,
        do_sample=True
    )

print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Framework Versions

  • PEFT 0.18.0
  • Transformers: 4.57.3
  • Pytorch: 2.9.1
  • Tokenizers: 0.22.1
Downloads last month
53
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jun47/gpt-oss-20b-trading

Adapter
(301)
this model