Downloads · 30 days
2
6% of all-time downloads
0xk1h0/codegen2.5-7b-py150k-r20-LoRA
codegen2.5-7b-py150k-r20-LoRA is a machine learning model from 0xk1h0. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
The following bitsandbytes quantization config was used during training: - quantmethod: bitsandbytes - loadin8bit: True - loadin4bit: False - llmint8threshold: 6.0 - llmint8skipmodules: None - llmint8enablefp32cpuoffl…
Downloads · 30 days
2
6% of all-time downloads
All-time downloads
36
Public
Repo size
50.5 MB
Likes
0
Public
Click a slice to open those files.
.pt33.7 MB · 67%
From the Hugging Face model README
import torch
import transformers
from finetune_peft import get_peft_config, PEFTArguments
from peft import get_peft_model
model_path = 'Salesforce/codegen25-7b-mono'
# peft_path = 'models/codegen25_7b/checkpoint'
peft_path = '0xk1h0/codegen25-7b-py150k-r20'
# peft_path = 'models/alpaca-llama-7b-peft/params.p'
torch.set_default_tensor_type(torch.cuda.HalfTensor)
model = transformers.AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, cache_dir='models')
peft_config = get_peft_config(peft_args=PEFTArguments(peft_mode="lora"))
model = get_peft_model(model, peft_config)
# model.load_state_dict(torch.load(peft_path), strict=False)
torch.set_default_tensor_type(torch.cuda.FloatTensor)
tokenizer = transformers.AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
batch = tokenizer("""
### Generate AES MODE encrypt function.
""", return_tensors="pt")
with torch.no_grad():
out = model.generate(
input_ids=batch["input_ids"],
attention_mask=torch.ones_like(batch["input_ids"]),
max_length=256,
do_sample=True,
temperature = 0.4,
top_p=0.95
)
print(tokenizer.decode(out[0]))
The following bitsandbytes quantization config was used during training:
The following bitsandbytes quantization config was used during training:
PEFT 0.5.0
PEFT 0.5.0