LlamaFactory Adapter Plugin
Configure environment variables
Before running a training task, configure these environment variables in bash:
| Environment variable | Description |
|---|---|
ECO_CLIENT_ID | Registered user email |
ECO_API_KEY | API Key authentication credential |
Example:
export ECO_CLIENT_ID="userxx@xx.com"
export ECO_API_KEY="XXXX"You can also write them to ~/.bashrc and activate the shell configuration:
vim ~/.bashrc
source ~/.bashrcSecurity note: never commit ECO_API_KEY to repositories, shared logs, or public tickets. Use environment variables or a controlled secret manager for collaboration.Start a training task
Replace these values based on your environment:
- Data path
- Model path
- Training argument file path
accelerateconfiguration file path
Complete training example:
export ECO_CLIENT_ID="userxx@xx.com" && \
export ECO_API_KEY="XXXX" && \
CUDA_VISIBLE_DEVICES=0,1 accelerate launch --config_file fsdp_config.yaml \
--main_process_port 29501 src/train.py train_args.yamlIf the task needs to preserve the current training state so it can continue after being stopped, set the following value in train_args.yaml:
save_only_model: falseThis setting saves optimizer state, learning-rate scheduler state, model weights, and other training state information.
Plugin log reference
1. Plugin imported and initialized successfully
The log includes:
[EcoPhase] ✅ EcoTrainAPI initialized.2. Plugin enabled
The log includes:
[EcoPhase] ✅ API is enabled.3. Plugin inactive
The log includes:
[EcoPhase] 🛑 API is disabled.4. Early stop triggered
The system automatically saves the model and prints a training summary, for example:
✅ Task early stopped at step 200/2000. Reduction: 90.0%. Saved GPU-hours: 1.03.This means:
| Field | Meaning |
|---|---|
200/2000 | The task stopped early at step 200 out of the planned 2000 steps |
Reduction: 90.0% | Training steps were reduced by about 90.0% |
Saved GPU-hours: 1.03 | Estimated savings of 1.03 GPU-hours |
Notes
- The plugin initialization code must be inserted at the correct position in
trainer.py. - Before running, confirm that the code uses
enabled=True. - Check
API is enabled/API is disabledfirst in the logs. - The plugin currently supports data parallelism only. Other parallel modes are not supported yet.
- The plugin currently supports Linux only.
