book-sft-pipeline

Convert ePub books into JSONL SFT datasets and train LoRA style models.

17.7k|1.5k|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering --skill book-sft-pipeline-muratcankoylan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: book-sft-pipeline
Source: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/examples/book-sft-pipeline
Command: npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering --skill book-sft-pipeline-muratcankoylan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

A complete system for converting books into SFT datasets and training style-transfer models, guiding the full pipeline from raw ePub to a model that writes in any author's voice.

Core Features & Use Cases

  • Extraction: Convert ePub to clean text (preserving chapters and structure) for dataset generation.
  • Intelligent segmentation: Break long works into coherent training chunks (~150-400 words) with overlap to maximize data efficiency.
  • Diverse instruction generation: Produce multiple prompts and system prompts to encourage robust style learning and prevent memorization.
  • Dataset construction: Output ready-to-use JSONL datasets formatted for LoRA-style fine-tuning with Tinker.
  • LoRA training pipeline: Fine-tune small adapters on base models to capture target authorial styles.
  • Real-world example: Build a Gertrude Stein style dataset from Three Lives and train a small model.

Quick Start

Run the book-sft-pipeline script in scripts/pipeline_example.py to generate a dataset from a book and begin the LoRA training workflow.

Frequently Asked Questions about book-sft-pipeline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an SFT dataset from an ePub book?

You can convert an ePub book into a training-ready SFT dataset by extracting clean text, segmenting it into coherent 150-400 word chunks, and generating diverse instructions formatted as JSONL for fine-tuning.

Can I train a model to write in a specific author's style using LoRA?

Yes, you can fine-tune a small LoRA adapter on a base model using a generated JSONL dataset to capture a specific authorial style and enable style-transfer training.

What is the best way to segment long-form novels for fine-tuning?

The best way to segment long-form novels for fine-tuning is breaking the text into coherent 150-400 word chunks with overlap, maximizing data efficiency while preserving context for instruction generation.

Does this pipeline support generating multiple prompts for style-transfer training?

Yes, the pipeline supports generating multiple prompts and system prompts during dataset construction to encourage robust style learning and prevent model memorization of the original text.

How do I validate an author-style model trained from a book?

You validate an author-style model trained from a book by checking the validation artifacts produced at the end of the LoRA training pipeline to ensure the output accurately reflects the target style.

Do I need Tinker to fine-tune small models with a book dataset?

Yes, you need Tinker for the LoRA training pipeline, as the outputted JSONL datasets are specifically formatted for LoRA-style fine-tuning with Tinker to capture the target authorial styles.