Preparation
LlamaFactory Adapter Plugin
Before you start, make sure:
- You can access the EcoPhase.AI private PyPI index.
- The base LlamaFactory training environment is installed and working.
- 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 -vvv \
--index-url https://ecophase-ai.com/pypi/simple/ \
"ecophase==1.2.0a1+llamafactory"3. Modify the training file
Open this file:
LlamaFactory/src/llamafactory/train/sft/trainer.pyIn 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:
| Value | Meaning |
|---|---|
enabled=True | Enable the plugin |
enabled=False | Disable the plugin |
