Quick Start

Preparation

LlamaFactory Adapter Plugin

Before you start, make sure:

  1. The base LlamaFactory training environment is installed and can run training tasks normally.
  2. Training data, test data, and the training model are ready.

1. Install communication dependencies

Run the following command in the LlamaFactory training environment to install gRPC and protobuf dependencies:

bash
pip install "grpcio>=1.76" "grpcio-tools>=1.76" "protobuf"

2. Install the plugin wheel

Install the LlamaFactory adapter plugin from the EcoPhase.AI private PyPI index:

bash
pip install -vvv \
  --index-url https://ecophase-ai.com/pypi/simple/ \
  "ecophase==1.3.0a1+llamafactory"

3. Modify the training file

Open this file:

text
LlamaFactory/src/llamafactory/train/sft/trainer.py

In the CustomSeq2SeqTrainer(Seq2SeqTrainer) class, insert the following code after the last line of the __init__ function:

python
from EcoPhase.EcoTrain import EcoTrain
EcoTrain.attach(self, enabled=True)

4. Enable the plugin

Use the enabled parameter to control whether the plugin is active:

python
EcoTrain.attach(self, enabled=True)

Parameter reference:

ValueMeaning
enabled=TrueEnable the plugin
enabled=FalseDisable the plugin

Before running a task, confirm that the code uses enabled=True.

EcoPhase Docs - Preparation - EcoPhase.AI