YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
- ha379 LTX-2.3 LoRA Training Repo
- 1) Clone repo
- 1.1) Kiểm tra đã kéo file thật từ repo
- 2) Cấu trúc dữ liệu trong repo
- 3) Cài AI Toolkit
- 4) Áp dụng patch resume checkpoint (quan trọng)
- 5) Copy config và sửa đúng path dataset
- 6) Chạy train bằng tmux + log realtime
- 7) Checkpoint và output
- 8) Push lên Hugging Face Hub (thủ công)
- 9) Resume từ trạng thái đã backup trong repo
- 1) Clone repo
ha379 LTX-2.3 LoRA Training Repo
Repo này chứa sẵn dataset và file config để train LoRA LTX-2.3 với ostris/ai-toolkit.
1) Clone repo
git lfs install
git clone https://huggingface.co/nhuquangls/ha379-ltx-lora
cd ha379-ltx-lora
git lfs pull
1.1) Kiểm tra đã kéo file thật từ repo
Kiểm tra file patch có phải file thật hay chỉ là Git LFS pointer:
head -n 3 patches/ai-toolkit/jobs/process/BaseSDTrainProcess.py
Nếu thấy nội dung dạng:
version https://git-lfs.github.com/spec/v1
oid sha256:...
size ...
thì đó là pointer, chưa phải file thật. Hãy chạy lại:
git lfs pull
2) Cấu trúc dữ liệu trong repo
Dataset đã nằm sẵn tại:
dataset/ha379
Mỗi ảnh có caption .txt tương ứng cùng tên file.
3) Cài AI Toolkit
git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit
python3 -m venv venv
source venv/bin/activate
pip install --no-cache-dir torch==2.9.1 torchvision==0.24.1 torchaudio==2.9.1 --index-url https://download.pytorch.org/whl/cu128
pip install -r requirements.txt
4) Áp dụng patch resume checkpoint (quan trọng)
Mặc định AI Toolkit chọn checkpoint resume theo ctime, có thể chọn sai khi file được copy/sync.
Repo này có sẵn file đã patch để chọn checkpoint theo tên file step (..._000000300.safetensors).
Sau khi clone ai-toolkit, thay file như sau:
cp /root/ha379-ltx-lora/patches/ai-toolkit/jobs/process/BaseSDTrainProcess.py /root/ai-toolkit/jobs/process/BaseSDTrainProcess.py
Nếu bạn clone ở path khác, đổi lại đường dẫn cho đúng.
5) Copy config và sửa đúng path dataset
Ví dụ làm việc trong /root:
cp /root/ha379-ltx-lora/train_lora_ltx23_ha379.yaml /root/ai-toolkit/
Mở file config và sửa datasets[0].folder_path thành đường dẫn tuyệt đối đến dataset trong repo bạn vừa clone.
Ví dụ:
datasets:
- folder_path: /root/ha379-ltx-lora/dataset/ha379
Lưu ý: nếu repo clone ở đường dẫn khác, phải sửa folder_path theo đúng vị trí thực tế.
6) Chạy train bằng tmux + log realtime
cd /root/ai-toolkit
source venv/bin/activate
# tạo session tmux chạy train nền
tmux new-session -d -s ltx23_ha379 'cd /root/ai-toolkit && source venv/bin/activate && HF_HUB_ENABLE_HF_TRANSFER=1 python run.py /root/ai-toolkit/train_lora_ltx23_ha379.yaml -l /root/ai-toolkit/output/ltx23_ha379_train.log'
Theo dõi realtime
# cách 1: xem trực tiếp trong tmux
tmux attach -t ltx23_ha379
# cách 2: tail log realtime
tail -f /root/ai-toolkit/output/ltx23_ha379_train.log
Thoát tmux mà không dừng train
Trong tmux bấm:
Ctrl+b rồi nhấn d
Dừng train
tmux kill-session -t ltx23_ha379
7) Checkpoint và output
Output nằm ở thư mục:
/root/ai-toolkit/output/ha379_ltx23_lora
Các file .safetensors là checkpoint LoRA dùng để inference/final publish.
8) Push lên Hugging Face Hub (thủ công)
Nếu dừng train giữa chừng mà vẫn muốn up checkpoint lên Hub, có thể upload thủ công từ thư mục output bằng huggingface_hub hoặc git lfs.
9) Resume từ trạng thái đã backup trong repo
Repo có sẵn bộ resume tại:
resume_state/ha379_ltx23_lora
Bao gồm:
ha379_ltx23_lora_000002100.safetensorsoptimizer.ptconfig.yaml
Khôi phục để resume
mkdir -p /root/ai-toolkit/output/ha379_ltx23_lora
cp /root/ha379-ltx-lora/resume_state/ha379_ltx23_lora/* /root/ai-toolkit/output/ha379_ltx23_lora/
Sau đó chạy lại lệnh train như bình thường, AI Toolkit sẽ tự resume từ checkpoint cao nhất theo tên file.
Trigger word trong config hiện tại: ha379