Downloads · 30 days
8
5% of all-time downloads
hwang2006/gpt-oss-20b-alpaca-2pct-lora
gpt-oss-20b-alpaca-2pct-lora is a text generation model from hwang2006. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This repository hosts a LoRA adapter (and tokenizer files) trained on top of openai/gpt-oss-20b.
Downloads · 30 days
8
5% of all-time downloads
All-time downloads
161
Public
Repo size
59.7 MB
Likes
0
Public
Click a slice to open those files.
.safetensors31.9 MB · 53%
From the Hugging Face model README
This repository hosts a LoRA adapter (and tokenizer files) trained on top of openai/gpt-oss-20b.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base = "openai/gpt-oss-20b"
adapter_id = "hwang2006/gpt-oss-20b-alpaca-2pct-lora"
tok = AutoTokenizer.from_pretrained(base)
base_model = AutoModelForCausalLM.from_pretrained(
base,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
messages = [
{"role":"system","content":"You are a helpful assistant."},
{"role":"user","content":"Quick test?"},
]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.9)
print(tok.decode(out[0], skip_special_tokens=True))
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16)
base = "openai/gpt-oss-20b"
adapter_id = "hwang2006/gpt-oss-20b-alpaca-2pct-lora"
tok = AutoTokenizer.from_pretrained(base)
base_model = AutoModelForCausalLM.from_pretrained(base, quantization_config=bnb, device_map="auto")
model = PeftModel.from_pretrained(base_model, adapter_id)