peft-fine-tuning

peft-fine-tuning is a skill for Claude Code, Codex from cyborg-garden/hermes-agent-mt. It costs 82 tokens per session (3,481 once invoked), scanned A, a copy of peft, MIT.

A Hugging Face library for fine-tuning language models by changing a small set of added parameters instead of the whole model. It includes methods such as LoRA and QLoRA for models from about 7B to 70B parameters.

In plain words
What is it for?
Use it to train task-specific adapters, fine-tune models on consumer or limited-memory GPUs, or serve several adapted versions from one base model.
Why use it?
It reduces the memory and computing resources needed for model training, especially when a full model update will not fit on available GPUs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to train task-specific adapters, fine-tune models on consumer or limited-memory GPUs, or serve several adapted versions from one base model.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cyborg-garden/hermes-agent-mt/peft
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cyborg-garden/hermes-agent-mt --skill peft
Clone the repo
git clone --depth 1 https://github.com/cyborg-garden/hermes-agent-mt

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for peft-fine-tuning

README.md
[![agentmods](https://agentmods.dev/badge/skills/cyborg-garden/hermes-agent-mt/peft/github.svg)](https://agentmods.dev/skills/cyborg-garden/hermes-agent-mt/peft)
Your own site
<a href="https://agentmods.dev/skills/cyborg-garden/hermes-agent-mt/peft"><img src="https://agentmods.dev/badge/skills/cyborg-garden/hermes-agent-mt/peft/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for peft-fine-tuning

Your own site · 80×15
<a href="https://agentmods.dev/skills/cyborg-garden/hermes-agent-mt/peft"><img src="https://agentmods.dev/badge/skills/cyborg-garden/hermes-agent-mt/peft.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,481 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 84% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00082 $0.03481
Opus 5 $0.00041 $0.01741
Sonnet 5 $0.00016 $0.00696
Haiku 4.5 $0.00008 $0.00348

Measured 9d ago against content hash 0dabfc591157, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

peft-fine-tuning scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

84% identical to peft — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

optional-skills/mlops/peft/SKILL.md · 436 lines

How it starts

The opening of the file, as written. The whole thing — 436 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PEFT (Parameter-Efficient Fine-Tuning)

Fine-tune LLMs by training <1% of parameters using LoRA, QLoRA, and 25+ adapter methods.

When to use PEFT

Use PEFT/LoRA when:

  • Fine-tuning 7B-70B models on consumer GPUs (RTX 4090, A100)
  • Need to train <1% parameters (6MB adapters vs 14GB full model)
  • Want fast iteration with multiple task-specific adapters
  • Deploying multiple fine-tuned variants from one base model

Use QLoRA (PEFT + quantization) when:

  • Fine-tuning 70B models on single 24GB GPU
  • Memory is the primary constraint
  • Can accept ~5% quality trade-off vs full fine-tuning

Use full fine-tuning instead when:

  • Training small models (<1B parameters)
  • Need maximum quality and have compute budget
  • Significant domain shift requires updating all weights

Quick start

Installation

# Basic installation
pip install peft

# With quantization support (recommended)
pip install peft bitsandbytes

# Full stack
pip install peft transformers accelerate bitsandbytes datasets

LoRA fine-tuning (standard)

from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer
from peft import get_peft_model, LoraConfig, TaskType
from datasets import load_dataset

# Load base model
model_name = "meta-llama/Llama-3.1-8B"
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
tokenizer.pad_token = tokenizer.eos_token

# LoRA configuration
lora_config = LoraConfig(
    task_type=TaskType.CAUSAL_LM,
    r=16,                          # Rank (8-64, higher = more capacity)
    lora_alpha=32,                 # Scaling factor (typically 2*r)
    lora_dropout=0.05,             # Dropout for regularization
    target_modules=["q_proj", "v_proj", "k_proj", "o_proj"],  # Attention layers
    bias="none"                    # Don't train biases
)

# Apply LoRA
model = get_peft_model(model, lora_config)
model.print_trainable_parameters()
# Output: trainable params: 13,631,488 || all params: 8,043,307,008 || trainable%: 0.17%

# Prepare dataset
dataset = load_dataset("databricks/databricks-dolly-15k", split="train")

def tokenize(example):
    text = f"### Instruction:\n{example['instruction']}\n\n### Response:\n{example['response']}"
    return tokenizer(text, truncation=True, max_length=512, padding="max_length")

tokenized = dataset.map(tokenize, remove_columns=dataset.column_names)

# Training
training_args = TrainingArguments(
    output_dir="./lora-llama",
    num_train_epochs=3,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=4,
    learning_rate=2e-4,
    fp16=True,
    logging_steps=10,
    save_strategy="epoch"
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=tokenized,
    data_collator=lambda data: {"input_ids": torch.stack([f["input_ids"] for f in data]),
                                 "attention_mask": torch.stack([f["attention_mask"] for f in data]),
                                 "labels": torch.stack([f["input_ids"] for f in data])}
)

trainer.train()

# Save adapter only (6MB vs 16GB)
model.save_pretrained("./lora-llama-adapter")

Read the full file on GitHub · 436 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 436 lines · 82 tokens per session scan A 0dabfc591157

Subscribe to this mod's changes

peft-fine-tuning is a skill published in the GitHub repository cyborg-garden/hermes-agent-mt (13 stars, last pushed yesterday), licensed MIT. It adds 82 tokens to every session and 3,481 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. It is 84% identical to peft, differing in 4 lines, and is treated as a copy.

Related

Other skills, from other repositories

hermes-memory-providers

Install and configure Mnemosyne as a Hermes Agent memory provider — local SQLite with vector search, episodic consolidation, and temporal knowledge graphs.

mnemosyne-oss/mnemosyne · 34 tokens

mnemosyne

Persistent cross-session memory via Mnemosyne — store, recall, and consolidate facts, preferences, and context.

mnemosyne-oss/mnemosyne · 22 tokens

mnemosyne-memory-override

Hard rule override that forces Mnemosyne for all durable memory storage. The legacy memory tool is DEPRECATED for user preferences, credentials, and project conventions. Use memory ONLY for ephemeral session state.

mnemosyne-oss/mnemosyne · 46 tokens

rag-local-lancedb

Build, query, and manage local vector embeddings and semantic search pipelines using LanceDB and HuggingFace/SentenceTransformers embeddings without cloud dependencies.

pedroiff0/awesome-skills · 35 tokens

polymorph

This spell is about representation change, not: Naming changes (same structure, different identifiers) Execution changes (same code, different runtime) Architecture changes (new system design) Duplication (same thing, different place) The key test: Can you point to a source artifact and a target artifact where the…

Hmbown/Wizards-of-the-Ghosts · 85 tokens

locate-object

In D&D, Locate Object senses the direction to a specific object within range. The real-world version is artifact search: finding that config file you know exists somewhere, locating a document someone mentioned but did not link, tracking down the source of a data value through a pipeline, or finding where a specific…

Hmbown/Wizards-of-the-Ghosts · 72 tokens