Skip to content

Converting to hf checkpoint

Visanth Vijayan edited this page Jan 25, 2024 · 3 revisions

Asumming MODEL as any valid value, eg, EleutherAI/pythia-1b

The below commands merge the lora weights and convert the lit gpt fine-tuned models into hf checkpoints.

mkdir -p output/$MODEL/code-gen-ui/merged

python scripts/merge_lora.py \
    --checkpoint_dir checkpoints/$MODEL \
    --lora_path output/$MODEL/code-gen-ui/lit_model_lora_finetuned.pth \
    --out_dir output/$MODEL/code-gen-ui/merged

mkdir -p output/$MODEL/hf/code-gen-ui/merged

python scripts/convert_lit_checkpoint.py \
    --checkpoint_path output/$MODEL/code-gen-ui/merged/lit_model.pth \
    --output_path output/$MODEL/hf/code-gen-ui/merged/lit_model.pth \
    --config_path checkpoints/$MODEL/lit_config.json

    * Use "lit_model.bin" for --output_path to make the sure the converted checkpoint is compatible with vLLM.
    * Use "pytorch_model.bin" for --output_path if you are intending to quantize the model for vLLM using AWQ.
Clone this wiki locally