Skip to content

Commit 5d78771

Browse files
authored
add dataflex new feature (#10)
1 parent 6374930 commit 5d78771

File tree

6 files changed

+87
-86
lines changed

6 files changed

+87
-86
lines changed

docs/en/notes/guide/basicinfo/framework.md

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ DataFlex is an advanced dynamic training framework built on [LlamaFactory](https
1515

1616
The core design philosophy of DataFlex is: **Data-centric intelligent training scheduling**. Traditional training methods typically use fixed data order and ratios, while DataFlex allows models to dynamically adjust data usage strategies based on their current state during training, achieving more efficient learning. It is designed to seamlessly integrate with LlamaFactory, providing researchers and developers with more flexible and powerful training control capabilities.
1717

18+
During the data selection process, it is often necessary to perform operations such as embedding, inference, and gradient computation on data samples. DataFlex is designed to provide a unified management framework for embedding, large model inference, and gradient computation.
19+
1820
## Core Architecture
1921

2022
### Overall Architecture Diagram
2123

2224
```
23-
┌─────────────────────────────────────────────────────────────┐
24-
│ LlamaFactory Framework │
25-
├─────────────────────────────────────────────────────────────┤
26-
│ Model Management · Data Processing · Optimizers │
27-
├─────────────────────────────────────────────────────────────┤
28-
│ │
29-
│ Training Layer (DataFlex replaces LlamaFactory trainer) │
30-
│ ┌─────────────────┬─────────────────┬─────────────────────┐ │
31-
│ │ Select Trainer │ Mix Trainer │ Weight Trainer │ │
32-
│ │ (Dynamic Sample │ (Dynamic Ratio)│ (Dynamic Weights) │ │
33-
│ │ Selection) │ │ │ │
34-
│ ├─────────────────┼─────────────────┼─────────────────────┤ │
35-
│ │ Selector Components│ Mixer Components│ Weighter Components│ │
36-
│ │ ┌─────────────┐ │ ┌─────────────┐ │ ┌─────────────────┐ │ │
37-
│ │ │Loss Selector│ │ │Random Mixer │ │ │ Loss Weighter │ │ │
38-
│ │ │LESS Selector│ │ │Custom Mixer │ │ │ Custom Weighter │ │ │
39-
│ │ │ Custom... │ │ │ ... │ │ │ ... │ │ │
40-
│ │ └─────────────┘ │ └─────────────┘ │ └─────────────────┘ │ │
41-
│ └─────────────────┴─────────────────┴─────────────────────┘ │
42-
└─────────────────────────────────────────────────────────────┘
25+
┌───────────────────────────────────────────────────────────────────────────────┐
26+
│ LlamaFactory Framework │
27+
├───────────────────────────────────────────────────────────────────────────────┤
28+
│ Model Management · Data Processing · Optimizers │
29+
├───────────────────────────────────────────────────────────────────────────────┤
30+
│ Training Layer (DataFlex replaces LlamaFactory trainer) │
31+
│ ┌────────────────────────┬────────────────────────┬────────────────────────┐ │
32+
│ │ Select Trainer │ Mix Trainer │ Weight Trainer │ │
33+
│ │ (Dynamic Selection) │ (Dynamic Ratio) │ (Dynamic Weights) │ │
34+
│ ├────────────────────────┼────────────────────────┼────────────────────────┤ │
35+
│ │ Selector Components │ Mixer Components │ Weighter Components │ │
36+
│ │ ┌──────────────────┐ │ ┌──────────────────┐ │ ┌───────────────────┐ │ │
37+
│ │ │ Loss Selector │ │ │ Random Mixer │ │ │ Loss Weighter │ │ │
38+
│ │ │ LESS Selector │ │ │ Custom Mixer │ │ │ Custom Weighter │ │ │
39+
│ │ │ Custom ... │ │ │ ... │ │ │ ... │ │ │
40+
│ │ └──────────────────┘ │ └──────────────────┘ │ └───────────────────┘ │ │
41+
│ └────────────────────────┴────────────────────────┴────────────────────────┘ │
42+
└───────────────────────────────────────────────────────────────────────────────┘
4343
```
4444

4545
### Component Hierarchy
@@ -60,24 +60,3 @@ DataFlex provides three core trainers that can seamlessly integrate into LlamaFa
6060
- **Select Trainer (Dynamic Selection Trainer)**: During training, dynamically selects a subset of samples from the dataset based on predefined strategies (Selector) for subsequent training, e.g., prioritizing "difficult" samples that the model finds challenging.
6161
- **Mix Trainer (Dynamic Ratio Trainer)**: Supports dynamic adjustment of mixing ratios for data from different sources or domains during training.
6262
- **Weight Trainer (Dynamic Weighting Trainer)**: Supports dynamic adjustment of sample weights during backpropagation, increasing learning intensity for model-preferred data.
63-
64-
## Usage Example
65-
66-
The training command is very similar to LlamaFactory. Below is an example using LESS, refer to the paper for details [https://arxiv.org/abs/2402.04333](https://arxiv.org/abs/2402.04333):
67-
68-
```bash
69-
FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/selectors/less.yaml
70-
```
71-
72-
**Note**: Unlike standard LlamaFactory, your `.yaml` configuration file must include DataFlex-specific parameters in addition to LlamaFactory's standard training parameters.
73-
74-
## Integration with LlamaFactory
75-
76-
DataFlex is fully compatible with LlamaFactory's configuration and usage:
77-
78-
1. **Configuration Compatibility**: Add DataFlex parameters on top of LlamaFactory configuration
79-
2. **Consistent Commands**: Use `dataflex-cli` instead of `llamafactory-cli`
80-
3. **Feature Preservation**: Supports all original LlamaFactory functionality
81-
4. **Seamless Switching**: Can fallback to original training mode with `train_type: static`
82-
83-
This design ensures users can progressively adopt DataFlex functionality without major modifications to existing workflows.

docs/en/notes/guide/basicinfo/install.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,24 @@ cd DataFlex
1414
pip install -e .
1515
pip install llamafactory
1616
```
17+
18+
## Usage Example
19+
20+
The training command is very similar to LlamaFactory. Below is an example using LESS, refer to the paper for details [https://arxiv.org/abs/2402.04333](https://arxiv.org/abs/2402.04333):
21+
22+
```bash
23+
FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/selectors/less.yaml
24+
```
25+
26+
**Note**: Unlike standard LlamaFactory, your `.yaml` configuration file must include DataFlex-specific parameters in addition to LlamaFactory's standard training parameters.
27+
28+
## Integration with LlamaFactory
29+
30+
DataFlex is fully compatible with LlamaFactory's configuration and usage:
31+
32+
1. **Configuration Compatibility**: Add DataFlex parameters on top of LlamaFactory configuration
33+
2. **Consistent Commands**: Use `dataflex-cli` instead of `llamafactory-cli`
34+
3. **Feature Preservation**: Supports all original LlamaFactory functionality
35+
4. **Seamless Switching**: Can fallback to original training mode with `train_type: static`
36+
37+
This design ensures users can progressively adopt DataFlex functionality without major modifications to existing workflows.

docs/en/notes/guide/basicinfo/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permalink: /en/guide/intro/basicinfo/intro/
66
---
77
# Introduction
88

9-
In recent years, the development of large models has largely depended on large-scale, high-quality training data. First, the preparation of high-quality datasets is crucial, a process completed by our other project [DataFlow](https://github.com/OpenDCAI/DataFlow/tree/main). Building on this foundation, the interaction between data and models during the training phase is equally critical, such as: data selection, ratio adjustment, and weight allocation for different data during training. Although academia has proposed several data selection strategies based on influence and other methods, there has always been a lack of a unified, easy-to-use, and extensible training framework.
9+
In recent years, the development of large models has largely depended on large-scale, high-quality training data. First, the preparation of high-quality datasets is crucial, a process completed by our other project [DataFlow](https://github.com/OpenDCAI/DataFlow/tree/main). Building on this foundation, the interaction between data and models during training is equally important, such as data selection, mixing, and weighting throughout the training process. Although several influence-based methods have been proposed in academia — such as those based on the distributional distance between training and test data, as well as strategies like TracIn, Influence Function, and PMP — there still lacks a unified, user-friendly, and extensible training framework.
1010

1111
To address this problem, we built [DataFlex](https://github.com/OpenDCAI/DataFlex/tree/main) based on [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory), a data-centric system focused on optimizing data-model interactions during training, combining both **ease of use** and **training effectiveness**.
1212

0 commit comments

Comments
 (0)