humanml3d-x-lora (#7)
Browse files- add lora weights for humanml3d-x (95ee27c4cb6909fe133054daf0e64ca7951072b1)
- add tokenizer (45129a5f9fd6fba5c90bf0a8c425b47c6a2b9ffa)
- add tokenizer (8c352f80e923e121a472023c509e4536ee6a1196)
- add llama 3.1 to the name of the ckpt (ab55ceac2d9950f24d2fca39d0fe3442ae235c39)
Files changed (12)
- .gitattributes+2
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_config.jsonAdded+21
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_model.safetensorsAdded+3
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/special_tokens_map.jsonAdded+16
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer.jsonAdded+3
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer_config.jsonAdded
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_config.jsonAdded+21
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_model.safetensorsAdded+3
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/special_tokens_map.jsonAdded+16
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer.jsonAdded+3
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer_config.jsonAdded
- lora_merge.pyAdded+36
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines333435363732 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texthgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer.json filter=lfs diff=lfs merge=lfs -texthgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer.json filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021{ "lora_alpha": 16, "r": 32, "target_modules": [ "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj" ], "modules_to_save": [ "embed_tokens", "lm_head" ], "peft_type": "LORA", "task_type": "CAUSAL_LM", "lora_dropout": 0.05, "bias": "none"}123version https://git-lfs.github.com/spec/v1oid sha256:a62b56414a3788f980a3499b054ef10ce516a28c36ae310d4fa7ca40bff55550size 455517420812345678910111213141516{ "bos_token": { "content": "<|begin_of_text|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "<|end_of_text|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123version https://git-lfs.github.com/spec/v1oid sha256:b8636a6e43c7fcbd40a00130ca75d6177c337d841ddb312363d14fffbd577a6esize 17307482123456789101112131415161718192021{ "lora_alpha": 16, "r": 32, "target_modules": [ "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj" ], "modules_to_save": [ "embed_tokens", "lm_head" ], "peft_type": "LORA", "task_type": "CAUSAL_LM", "lora_dropout": 0.05, "bias": "none"}123version https://git-lfs.github.com/spec/v1oid sha256:57d50670de4275c79b0f36cbcfe63e7e3743a75deb8b1bf89a72f8b873291d83size 455517420812345678910111213141516{ "bos_token": { "content": "<|begin_of_text|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "<|end_of_text|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123version https://git-lfs.github.com/spec/v1oid sha256:b8636a6e43c7fcbd40a00130ca75d6177c337d841ddb312363d14fffbd577a6esize 17307482123456789101112131415161718192021222324252627282930313233343536# load_and_merge.pyfrom transformers import AutoModelForCausalLM, AutoTokenizerfrom peft import PeftModelimport torchimport os
base_model_path = "YOUR_PATH_TO_LLAMA-3.1-8B" lora_adapter_path = "YOUR_PATH_TO_LORA"save_dir = "YOUR_SAVE_DIR"
os.makedirs(save_dir, exist_ok=True)
print("Loading base model...")base_model = AutoModelForCausalLM.from_pretrained( base_model_path,)
tokenizer = AutoTokenizer.from_pretrained(lora_adapter_path, legacy=True)
base_model.resize_token_embeddings(len(tokenizer))
print("Loading LoRA adapter...")peft_model = PeftModel.from_pretrained(base_model, lora_adapter_path)
print("Merging...")merged_model = peft_model.merge_and_unload()breakpoint()
print("Saving merged model...")merged_model.save_pretrained(save_dir)tokenizer.save_pretrained(save_dir)
print(f"✅ 合并完成").gitattributes+2
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_config.jsonAdded+21
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_model.safetensorsAdded+3
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/special_tokens_map.jsonAdded+16
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer.jsonAdded+3
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer_config.jsonAdded
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_config.jsonAdded+21
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_model.safetensorsAdded+3
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/special_tokens_map.jsonAdded+16
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer.jsonAdded+3
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer_config.jsonAdded
lora_merge.pyAdded+36