Skip to content

Commit be4ba20

Browse files
(WIP) docs: Fix for some of the documentation formatting issues (#381)
* Add blank lines for improved readability in format.md * Fix: (docs) blanks-around-lists and blanks-around-headings errors in format.md * Fix: (docs) add missing newlines at the end of file, and added blanked spaces after headings and fences for improved formatting in built-in-reference.md and overview.md * Reverting the description of GRPO formatter * Update docs/formatters/built-in-reference.md Added comments describing ```standardize_data_formats``` and ```formatting_prompts_func```. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Fix: (docs) add missing newlines at the end of files and ensure consistent formatting in multiple documentation files for improved readability --------- Co-authored-by: Jyotirmay Chakraborty <93432859+UltimatePlutoC@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 20f53be commit be4ba20

10 files changed

Lines changed: 93 additions & 15 deletions

File tree

docs/cli/format.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dataset:
7575
Formats data for Alpaca-style instruction tuning.
7676
7777
**Default configuration:**
78+
7879
```yaml
7980
instruction_template: "### Instruction:\n{instruction}\n\n### Response:"
8081
include_empty_input: false
@@ -85,6 +86,7 @@ include_empty_input: false
8586
Formats data in ChatML format (structured or text).
8687
8788
**Default configuration:**
89+
8890
```yaml
8991
output_format: "text"
9092
start_token: "<|im_start|>"
@@ -97,6 +99,7 @@ include_system: false
9799
Formats data for GRPO (Guided Reasoning Process Optimization) training.
98100
99101
**Default configuration:**
102+
100103
```yaml
101104
reasoning_start_tag: "<start_working_out>"
102105
reasoning_end_tag: "<end_working_out>"
@@ -109,6 +112,7 @@ solution_end_tag: "</SOLUTION>"
109112
The command expects a JSONL file where each line is a JSON object. Supported formats include:
110113
111114
1. **Question-Answer format:**
115+
112116
```json
113117
{
114118
"question": "What is recursion?",
@@ -117,6 +121,7 @@ The command expects a JSONL file where each line is a JSON object. Supported for
117121
```
118122

119123
2. **Messages format:**
124+
120125
```json
121126
{
122127
"messages": [
@@ -127,6 +132,7 @@ The command expects a JSONL file where each line is a JSON object. Supported for
127132
```
128133

129134
3. **Instruction format:**
135+
130136
```json
131137
{
132138
"instruction": "Write a function to calculate factorial",
@@ -140,6 +146,7 @@ The command expects a JSONL file where each line is a JSON object. Supported for
140146
You can now format datasets directly from the Hugging Face Hub using `--repo`, or continue using local JSONL files. Many HF datasets come in compatible formats:
141147

142148
**Format directly from a Hub repo:**
149+
143150
```bash
144151
# Pull from Hub, format to Harmony, write to formatted.jsonl
145152
deepfabric format --repo "org/dataset-name" --format harmony
@@ -153,6 +160,7 @@ PY
153160
```
154161

155162
**For datasets with `messages` field (e.g., chat datasets):**
163+
156164
```bash
157165
# Download dataset using datasets library or git
158166
huggingface-cli download microsoft/DialoGPT-medium --repo-type dataset
@@ -169,18 +177,21 @@ deepfabric format orca_math.jsonl -f chatml
169177
```
170178

171179
**For datasets with instruction format (e.g., Alpaca-style):**
180+
172181
```bash
173182
# Many HF datasets use instruction/input/output format
174183
deepfabric format alpaca_dataset.jsonl -f chatml
175184
```
176185

177186
**Common HuggingFace dataset formats supported:**
187+
178188
- OpenAI ChatML format (`messages` field)
179189
- Alpaca format (`instruction`, `input`, `output`)
180190
- ShareGPT format (`conversations`)
181191
- Q&A format (`question`, `answer` or `response`)
182192

183193
**Example conversion workflow (local):**
194+
184195
```bash
185196
# 1. Download from HuggingFace
186197
huggingface-cli download tatsu-lab/alpaca --repo-type dataset
@@ -196,11 +207,13 @@ deepfabric format alpaca.jsonl -f grpo -o alpaca_grpo.jsonl
196207
## Workflow Example
197208

198209
1. Generate a dataset:
210+
199211
```bash
200212
deepfabric generate config.yaml
201213
```
202214

203215
2. Apply different formatters to the same dataset:
216+
204217
```bash
205218
# For ChatML training
206219
deepfabric format dataset_raw.jsonl -f chatml -o dataset_chatml.jsonl
@@ -213,6 +226,7 @@ deepfabric format dataset_raw.jsonl -f grpo -o dataset_grpo.jsonl
213226
```
214227

215228
This allows you to prepare the same dataset for different training frameworks without regenerating the data.
229+
216230
### TRL SFT Tools
217231

218232
Use `-f trl` to convert agent/tool datasets to the Hugging Face TRL SFT tool-calling format. This maps to the built-in `trl_sft_tools` formatter.

docs/cli/generate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,4 @@ python -m json.tool your_dataset.jsonl > /dev/null
162162
wc -l your_dataset.jsonl
163163
```
164164

165-
This validation ensures the generation process completed successfully and produced properly formatted output ready for use in training or evaluation pipelines.
165+
This validation ensures the generation process completed successfully and produced properly formatted output ready for use in training or evaluation pipelines.

docs/cli/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ Detailed documentation for each command covers syntax, options, examples, and co
8686
[**visualize**](visualize.md) - Topic graph visualization and analysis
8787
[**upload**](upload.md) - Hugging Face Hub integration and publishing
8888

89-
Each command section includes practical examples, common usage patterns, and troubleshooting guidance for typical issues encountered during synthetic data generation workflows.
89+
Each command section includes practical examples, common usage patterns, and troubleshooting guidance for typical issues encountered during synthetic data generation workflows.

docs/cli/upload.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,4 @@ Subsequent uploads to existing repositories update both data and metadata:
150150
**Change Documentation** automatically updates dataset cards to reflect changes in generation methodology or content characteristics.
151151

152152
??? tip "Publication Best Practices"
153-
Review generated dataset cards before publication and consider adding domain-specific usage notes or limitations. Use descriptive repository names and comprehensive tagging to maximize appropriate discovery and usage of your synthetic datasets.
153+
Review generated dataset cards before publication and consider adding domain-specific usage notes or limitations. Use descriptive repository names and comprehensive tagging to maximize appropriate discovery and usage of your synthetic datasets.

docs/cli/validate.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The validation process examines multiple aspects of your configuration:
3030

3131
Successful validation produces a summary of your configuration:
3232

33-
```
33+
```bash
3434
Configuration is valid
3535

3636
Configuration Summary:
@@ -49,7 +49,7 @@ The summary provides an overview of key parameters, while warnings highlight pot
4949

5050
Configuration problems are reported with clear categorization and guidance:
5151

52-
```
52+
```bash
5353
❌ Configuration validation failed:
5454
- data_engine section is required
5555
- Invalid provider 'invalid_provider' in topic_tree
@@ -66,7 +66,7 @@ Beyond basic validation, the command provides insights into your configuration c
6666
deepfabric validate config.yaml
6767
```
6868

69-
```
69+
```bash
7070
Configuration Analysis:
7171
Estimated generation time: 15-25 minutes
7272
Estimated API costs: $2.50-4.00 (OpenAI GPT-4)
@@ -87,7 +87,7 @@ For OpenAI configurations, it verifies model name formats and availability. For
8787
deepfabric validate config.yaml
8888
```
8989

90-
```
90+
```bash
9191
Provider Validation:
9292
OpenAI API key detected (OPENAI_API_KEY)
9393
Model gpt-4 is available
@@ -141,4 +141,4 @@ The validate command uses standard exit codes for scripting integration:
141141
These exit codes enable reliable automation and continuous integration workflows where configuration validation is part of the build process.
142142

143143
??? tip "Continuous Validation Strategy"
144-
Consider adding configuration validation to your version control hooks or continuous integration pipeline. This practice catches configuration regressions and ensures that all committed configurations are functional and ready for use.
144+
Consider adding configuration validation to your version control hooks or continuous integration pipeline. This practice catches configuration regressions and ensures that all committed configurations are functional and ready for use.

docs/cli/visualize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@ Generated SVG files are self-contained vector graphics that:
112112
- Use standard web colors and fonts for maximum compatibility
113113

114114
??? tip "Visualization Best Practices"
115-
Generate visualizations after topic graph creation but before dataset generation to validate topic coverage and relationships. Use visualizations to identify overly dense or sparse areas in your domain coverage, then adjust generation parameters accordingly.
115+
Generate visualizations after topic graph creation but before dataset generation to validate topic coverage and relationships. Use visualizations to identify overly dense or sparse areas in your domain coverage, then adjust generation parameters accordingly.

docs/formatters/built-in-reference.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,23 @@ formatters:
5959
### Framework Compatibility
6060
6161
**Unsloth:**
62+
6263
```python
6364
dataset = load_dataset("your-username/your-dataset", split="train")
64-
dataset = standardize_data_formats(dataset)
65-
dataset = dataset.map(formatting_prompts_func, batched=True)
65+
dataset = standardize_data_formats(dataset) # Placeholder for data standardization
66+
dataset = dataset.map(formatting_prompts_func, batched=True) # Placeholder for formatting function
6667
```
6768

6869
**Axolotl:**
70+
6971
```yaml
7072
datasets:
7173
- path: your-username/your-dataset
7274
type: conversation
7375
```
7476
7577
**HuggingFace TRL:**
78+
7679
```python
7780
from trl import SFTTrainer
7881
trainer = SFTTrainer(
@@ -231,6 +234,7 @@ config:
231234
### Role Hierarchy
232235

233236
The Harmony format enforces a strict role hierarchy (highest to lowest priority):
237+
234238
1. **system** - System instructions and metadata
235239
2. **developer** - Developer instructions and tool definitions
236240
3. **user** - User messages
@@ -240,6 +244,7 @@ The Harmony format enforces a strict role hierarchy (highest to lowest priority)
240244
### Channels
241245

242246
Assistant messages can be assigned to different channels:
247+
243248
- **final**: User-facing responses (default)
244249
- **analysis**: Internal chain-of-thought reasoning (not safe for user display)
245250
- **commentary**: Function tool calls and preambles
@@ -254,6 +259,7 @@ Assistant messages can be assigned to different channels:
254259
### Output Formats
255260

256261
**Text Format** (`output_format: "text"`):
262+
257263
```text
258264
<|start|>system<|message|>
259265
You are ChatGPT, a large language model trained by OpenAI.
@@ -289,6 +295,7 @@ The weather in London is currently 18°C with cloudy conditions.
289295
```
290296

291297
**Structured Format** (`output_format: "structured"`):
298+
292299
```json
293300
{
294301
"messages": [
@@ -360,6 +367,7 @@ namespace functions {
360367
### Example Configurations
361368

362369
**Basic Chat Configuration**:
370+
363371
```yaml
364372
formatters:
365373
- name: "harmony_chat"
@@ -372,6 +380,7 @@ formatters:
372380
```
373381

374382
**Advanced Configuration with Tools**:
383+
375384
```yaml
376385
formatters:
377386
- name: "harmony_tools"
@@ -390,6 +399,7 @@ formatters:
390399
```
391400

392401
**Chain-of-Thought Configuration**:
402+
393403
```yaml
394404
formatters:
395405
- name: "harmony_cot"
@@ -503,20 +513,23 @@ formatters:
503513
### Advanced Configuration
504514

505515
**Disable Reasoning Prefixes**:
516+
506517
```yaml
507518
config:
508519
include_reasoning_prefix: false
509520
tool_call_format: "<tool_call>\n{tool_call}\n</tool_call>"
510521
```
511522

512523
**Custom Tool Call Format**:
524+
513525
```yaml
514526
config:
515527
tool_call_format: "FUNCTION_CALL: {tool_call}"
516528
reasoning_prefix_template: "Let me {action}."
517529
```
518530

519531
**Plain Text Tool Responses**:
532+
520533
```yaml
521534
config:
522535
tool_response_as_json: false
@@ -629,6 +642,7 @@ formatters:
629642
### Advanced Configuration
630643

631644
**Override System Prompt for Training**:
645+
632646
```yaml
633647
config:
634648
include_system_prompt: true
@@ -639,12 +653,14 @@ config:
639653
```
640654

641655
**Clean Output (Remove Original Tools Field)**:
656+
642657
```yaml
643658
config:
644659
remove_available_tools_field: true
645660
```
646661

647662
**Disable Schema Validation (Performance)**:
663+
648664
```yaml
649665
config:
650666
validate_tool_schemas: false
@@ -666,6 +682,7 @@ deepfabric format --repo org/agent-dataset --formatter trl -o trl_formatted.json
666682
```
667683

668684
This workflow is ideal for:
685+
669686
- Converting existing agent/tool datasets to TRL format
670687
- Reformatting community datasets for your training pipeline
671688
- Experimenting with different formatters on public datasets
@@ -753,6 +770,7 @@ config:
753770
### Output Formats
754771

755772
**Structured Format** (`output_format: "structured"`):
773+
756774
```json
757775
{
758776
"messages": [
@@ -764,6 +782,7 @@ config:
764782
```
765783

766784
**Text Format** (`output_format: "text"`):
785+
767786
```json
768787
{
769788
"text": "<|im_start|>system\nYou are a helpful assistant.\n<|im_end|>\n<|im_start|>user\nHello!\n<|im_end|>\n<|im_start|>assistant\nHi there! How can I help you today?\n<|im_end|>"
@@ -788,31 +807,36 @@ formatters:
788807
## Choosing the Right Formatter
789808

790809
### For Mathematical Reasoning Training
810+
791811
- **GRPO**: When training models to show step-by-step reasoning with extractable answers
792812
- **Harmony**: For models that need to show internal reasoning (analysis channel) separate from final answers
793813
- **Alpaca**: For instruction-following with math problems
794814
- **ChatML**: For conversational math tutoring scenarios
795815

796816
### For General Instruction Following
817+
797818
- **Alpaca**: Standard instruction-following format
798819
- **ChatML**: When you need conversation context and role clarity
799820
- **Harmony**: For gpt-oss models with developer instructions and role hierarchy
800821
- **Conversations**: For Unsloth, Axolotl, or HF TRL training with conversations format
801822

802823
### For Chat and Dialogue
824+
803825
- **Harmony**: Advanced format with channels, tool support, and role hierarchy for gpt-oss models
804826
- **ChatML**: ChatML-compatible format with `<|im_start|>/<|im_end|>` delimiters
805827
- **Conversations**: Standard conversations format for multiple frameworks
806828
- **Alpaca**: Single-turn instruction-response pairs
807829

808830
### For Tool/Function Calling
831+
809832
- **TRL SFT Tools**: HuggingFace TRL SFTTrainer with OpenAI function schema (recommended for modern training workflows)
810833
- **Single Tool Call**: Individual tool call format with each call in its own message exchange
811834
- **Tool Calling**: Embedded tool calling with thinking traces and multiple tools per response
812835
- **Harmony**: TypeScript-style function definitions with channels for tool calls and responses
813836
- **Custom formatters**: For specific tool calling conventions
814837

815838
### For Custom Requirements
839+
816840
Create a [custom formatter](custom-formatter-guide.md) that inherits from BaseFormatter.
817841

818842
## Validation and Error Handling
@@ -829,4 +853,4 @@ All built-in formatters include:
829853
- Built-in formatters are optimized for both speed and memory efficiency
830854
- Large datasets are processed in streaming fashion when possible
831855
- Validation can be disabled for better performance in production
832-
- Formatter instances are cached for repeated use
856+
- Formatter instances are cached for repeated use

docs/formatters/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ The formatter system includes comprehensive error handling:
113113

114114
- [Built-in Formatter Reference](built-in-reference.md) - Documentation for all included formatters
115115
- [Custom Formatter Guide](custom-formatter-guide.md) - How to create your own formatters
116-
- [API Reference](api-reference.md) - Complete API documentation
116+
- [API Reference](api-reference.md) - Complete API documentation

0 commit comments

Comments
 (0)