Downloads · 30 days
7
21% of all-time downloads
Mukesh0606/solidity-codellama-lora-r64-final
solidity-codellama-lora-r64-final is a text generation model from Mukesh0606. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as llama2.
This repository contains a LoRA / PEFT adapter (not a full model) fine-tuned on top of AlfredPros/CodeLlama-7b-Instruct-Solidity.
Downloads · 30 days
7
21% of all-time downloads
All-time downloads
33
Public
Repo size
403 MB
Likes
0
Public
Click a slice to open those files.
.pt269 MB · 66%
From the Hugging Face model README
This repository contains a LoRA / PEFT adapter (not a full model) fine-tuned on top of
AlfredPros/CodeLlama-7b-Instruct-Solidity.
This is the final checkpoint of the run, saved at global step 1,485,045 — the full
5 epochs (max_steps reached, should_training_stop = true). Training is complete; this is
the adapter to use for inference. Optimizer / scheduler / RNG state are also included if you wish
to continue training beyond 5 epochs.
| Property | Value |
|---|---|
| Base model | AlfredPros/CodeLlama-7b-Instruct-Solidity (CodeLlama-7B, Solidity-tuned) |
| Adapter type | LoRA |
| PEFT version | 0.14.0 |
| Task type | CAUSAL_LM |
Rank (r) | 64 |
lora_alpha | 16 |
lora_dropout | 0.1 |
| Target modules | q_proj, v_proj |
| Bias | none |
| Tokenizer | CodeLlamaTokenizerFast |
| Adapter size | ~134 MB (adapter_model.safetensors) |
| Metric | Value |
|---|---|
| Global step | 1,485,045 / 1,485,045 (complete) |
| Epochs | 5.0 / 5 |
| Final train loss | ~0.26 |
| Final mean token accuracy | ~0.93 |
| Train batch size | 1 |
| Save / log steps | 5,000 |
| Eval steps | 500 |
| File | Purpose |
|---|---|
adapter_config.json | LoRA/PEFT configuration |
adapter_model.safetensors | LoRA adapter weights (~134 MB) |
tokenizer.json, tokenizer_config.json, special_tokens_map.json | Tokenizer |
optimizer.pt | Optimizer state (only needed to continue training) |
scheduler.pt | LR scheduler state (only needed to continue training) |
scaler.pt | Mixed-precision grad scaler state |
rng_state.pth | RNG state for reproducible resume |
trainer_state.json | Full trainer progress / loss history |
training_args.bin | Serialized TrainingArguments from the run |
Note: The ~13 GB base model weights are not included here — they are pulled separately from
AlfredPros/CodeLlama-7b-Instruct-Solidity. The training dataset and training script are also not included.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
BASE = "AlfredPros/CodeLlama-7b-Instruct-Solidity"
ADAPTER = "Mukesh0606/solidity-codellama-lora-r64-final" # or a local path to this folder
tokenizer = AutoTokenizer.from_pretrained(ADAPTER)
base_model = AutoModelForCausalLM.from_pretrained(BASE, device_map="auto")
model = PeftModel.from_pretrained(base_model, ADAPTER)
model.eval()
prompt = "// Write a secure ERC20 token contract in Solidity\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(out[0], skip_special_tokens=True))
merged = model.merge_and_unload() # folds LoRA weights into the base
merged.save_pretrained("codellama-7b-solidity-merged")
tokenizer.save_pretrained("codellama-7b-solidity-merged")
This run finished at its planned max_steps. To train further you would raise
num_train_epochs / max_steps in your TrainingArguments and resume:
from transformers import Trainer
# Re-create the SAME base model, LoRA config, tokenizer, dataset, and updated TrainingArguments.
trainer = Trainer(model=peft_model, args=training_args, train_dataset=..., ...)
trainer.train(resume_from_checkpoint="path/to/checkpoint-1485045")
Requirements:
AlfredPros/CodeLlama-7b-Instruct-Solidity).adapter_config.json).train_batch_size=1).If you load the adapter manually via
PeftModel.from_pretrainedfor further training rather than viaresume_from_checkpoint, passis_trainable=True.adapter_config.jsonhasinference_mode: true, which is correct for inference; theTrainerresume path switches back to training mode automatically.
Trainer)Inherits the base model's license (Llama 2 Community License via CodeLlama). Review the base model card before commercial use.