Skip to content

Converting to hf checkpoint

Kannan Ramamoorthy edited this page Nov 28, 2023 · 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
Clone this wiki locally