Skip to main content

Preparation

LlamaFactory Adapter Plugin

Before you start, make sure:

  1. You have the plugin wheel and TLS root certificate. Download link
  2. The base LlamaFactory training environment is installed and working.
  3. 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:

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

2. Install the plugin

Install the plugin with:

pip install ecophase-1.1.0a1+llamafactory-cp313-cp313-linux_x86_64.whl

3. Modify the training file

Open this file:

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

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

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

4. Enable the plugin

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

EcoMonitor.attach(self, enabled=True)

Parameter reference:

ValueMeaning
enabled=TrueEnable the plugin
enabled=FalseDisable the plugin