book-sft-pipeline
Skill by muratcankoylan
Book SFT Pipeline converts an ePub book into a fine-tuning dataset and trains a LoRA style-transfer model. It is for developers who want a model to write in a specific author's voice.
Install book-sft-pipeline
Built from the published package, never by AI.
git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.claude/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/examples/book-sft-pipeline ~/.claude/skills/book-sft-pipelineRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/examples/book-sft-pipeline ~/.gemini/antigravity-cli/skills/book-sft-pipelineAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill describes a pipeline that turns a book into supervised fine-tuning data for style transfer. It starts by extracting paragraphs from an ePub file, then splits the text into chunks of 150 to 400 words at natural boundaries. An LLM writes a short description of each chunk, and that description is paired with several prompt templates and system prompts to build chat-format training examples in JSONL.
The skill includes example code for training a LoRA adapter on the Tinker platform, using the Qwen/Qwen3-8B-Base model with rank 32. It also covers validation, including tests on modern scenarios the book could not contain and a grep check for copied phrases. It is aimed at developers and researchers building author-voice or style-transfer models from literary works.
Written from the project's SKILL.md and checked against it.
What it can do
- ePub text extractionPulls paragraph-level text from ePub chapters and drops front and back matter.
- Literary segmentationSplits text into 150 to 400 word chunks at paragraph boundaries with overlap.
- Instruction generationUses a fast LLM to describe each chunk without quoting the text.
- Diverse prompt templatesBuilds examples from 15 or more prompt templates and 5 or more system prompts.
- JSONL dataset buildingFormats chunks as system, user and assistant messages for SFT training.
- LoRA training on TinkerShows a training loop for a LoRA adapter on Qwen/Qwen3-8B-Base.
- Style validationTests outputs on modern scenarios and checks training data for copied phrases.
What you need
- Tinker or a similar SFT training platform
- Python
- epub2 and BeautifulSoup libraries
- An LLM API for instruction generation, such as Gemini Flash
Try asking
- Turn this ePub into a segmented author-voice SFT dataset in JSONL.
- Write a LoRA training config for Qwen3-8B-Base with rank 32.
- Check my training data for exact phrases that the model might copy.
Good to know
- Examples are based on a single book, which can cause character name leakage.
- Expected results in the source, such as about 50% perfect style transfer, are not measured benchmarks.
- Cost figures are estimates given in the source.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: examples/book-sft-pipeline/SKILL.md, examples/book-sft-pipeline/scripts/pipeline_example.py. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
README.md3 KB -
SKILL.md14 KB -
examples/gertrude-stein/README.md5 KB -
examples/gertrude-stein/dataset_sample.jsonl4 KB -
examples/gertrude-stein/pangram/Screenshot 2025-12-27 at 3.05.04 AM.png202 KB
Show all 13 files
-
examples/gertrude-stein/pangram/Screenshot 2025-12-27 at 3.05.36 AM.png134 KB -
examples/gertrude-stein/pangram/Screenshot 2025-12-27 at 3.07.18 AM.png129 KB -
examples/gertrude-stein/sample_outputs.md3 KB -
examples/gertrude-stein/training_config.json3 KB -
references/segmentation-strategies.md11 KB -
references/tinker-format.md6 KB -
references/tinker.txt143 KB -
scripts/pipeline_example.py7 KB
Alternatives to book-sft-pipeline
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
book-sft-pipeline: common questions
Why does the pipeline use ePub instead of PDF?
The source says OCR errors from PDF files become learned patterns in the model. It recommends ePub for that reason.
Which base model does it train?
The example trains Qwen/Qwen3-8B-Base with a LoRA rank of 32. The source says base models are more malleable for new styles than instruct models.
How does it check that the model learned style and not content?
It tests the model with scenarios that could not exist in the original book. It also greps the training data for phrases from the output to confirm they are not copied.
How do I install book-sft-pipeline?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is book-sft-pipeline free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is book-sft-pipeline safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to book-sft-pipeline?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
