Download README.md from starcrow/sft_qat: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/starcrow/sft_qat/resolve/main/README.md
- Command line
-
hf download hf://starcrow/sft_qat/README.md
-
curl -L -o README.md https://huggingface.co/starcrow/sft_qat/resolve/main/README.md
JSONL SFT with QAT-LoRA
์ด ํ๋ก์ ํธ๋ JSONL ๊ธฐ๋ฐ SFT(Supervised Fine-Tuning)๋ฅผ ์ํํ๋ฉฐ ๊ธฐ์กด GGUF Q4_0 QAT-LoRA๋ฅผ ์ ์งํฉ๋๋ค.
JSONL ํ์
ํ ์ค์ ํ๋์ JSON ๊ฐ์ฒด๋ฅผ ๋ฃ์ต๋๋ค. --format auto(๊ธฐ๋ณธ๊ฐ)๋ ์๋ ์ธ ํ์์ ์๋ ๊ฐ์งํฉ๋๋ค.
{"messages":[{"role":"user","content":"ํ๊ตญ์ ์๋๋?"},{"role":"assistant","content":"์์ธ์
๋๋ค."}]}
{"instruction":"๋ค์ ๋ฌธ์ฅ์ ์์ฝํด์ค.","input":"๊ธด ๋ณธ๋ฌธ", "output":"์์ฝ๋ฌธ"}
{"prompt":"์ง๋ฌธ: 2+2๋?\n๋ต:","completion":"4"}
messages ํ์์ ๋ชจ๋ธ tokenizer์ chat template ๋ฐ assistant token mask ์ง์์ด ํ์ํฉ๋๋ค. ์ง์ํ์ง ์์ผ๋ฉด prompt/completion ํ์์ ์ฌ์ฉํ์ธ์.
์คํ
config.py์ base_model์ ์ค์ ๋ชจ๋ธ ๊ฒฝ๋ก๋ก ๋ณ๊ฒฝํ ํ ์คํํฉ๋๋ค.
python train_sft.py --data_path .\data\train.jsonl --format auto
์์ฃผ ์ฐ๋ ์ต์ :
python train_sft.py --data_path .\data\train.jsonl --epochs 3 --lr 1e-5 --output_dir .\output_sft_qat
python train_sft.py --data_path .\data\train.jsonl --resume
ํ๋กฌํํธ ํ ํฐ์ labels=-100์ผ๋ก ๋ง์คํน๋์ด loss์ ํฌํจ๋์ง ์๊ณ , assistant ์๋ต๋ง ํ์ตํฉ๋๋ค. QAT warm-up, fake quantization, QAT-LoRA ์ฒดํฌํฌ์ธํธ ๋ฐ ์ต์ข
๋ณํฉ ์ ์ฅ์ ๊ธฐ์กด ๊ตฌํ์ ๊ทธ๋๋ก ์ฌ์ฉํฉ๋๋ค.