humanml3d-x-lora
#7
by
CharlesGao
- opened
- .gitattributes +2 -0
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_config.json +21 -0
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_model.safetensors +3 -0
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/special_tokens_map.json +16 -0
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer.json +3 -0
- hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer_config.json +0 -0
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_config.json +21 -0
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_model.safetensors +3 -0
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/special_tokens_map.json +16 -0
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer.json +3 -0
- hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer_config.json +0 -0
- lora_merge.py +36 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"lora_alpha": 16,
|
| 3 |
+
"r": 32,
|
| 4 |
+
"target_modules": [
|
| 5 |
+
"q_proj",
|
| 6 |
+
"k_proj",
|
| 7 |
+
"v_proj",
|
| 8 |
+
"o_proj",
|
| 9 |
+
"gate_proj",
|
| 10 |
+
"up_proj",
|
| 11 |
+
"down_proj"
|
| 12 |
+
],
|
| 13 |
+
"modules_to_save": [
|
| 14 |
+
"embed_tokens",
|
| 15 |
+
"lm_head"
|
| 16 |
+
],
|
| 17 |
+
"peft_type": "LORA",
|
| 18 |
+
"task_type": "CAUSAL_LM",
|
| 19 |
+
"lora_dropout": 0.05,
|
| 20 |
+
"bias": "none"
|
| 21 |
+
}
|
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a62b56414a3788f980a3499b054ef10ce516a28c36ae310d4fa7ca40bff55550
|
| 3 |
+
size 4555174208
|
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/special_tokens_map.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<|begin_of_text|>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|end_of_text|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
}
|
| 16 |
+
}
|
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8636a6e43c7fcbd40a00130ca75d6177c337d841ddb312363d14fffbd577a6e
|
| 3 |
+
size 17307482
|
hgpt/humanml3d-x/lora/llama-3.1-cot_maskinput_pkeep/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"lora_alpha": 16,
|
| 3 |
+
"r": 32,
|
| 4 |
+
"target_modules": [
|
| 5 |
+
"q_proj",
|
| 6 |
+
"k_proj",
|
| 7 |
+
"v_proj",
|
| 8 |
+
"o_proj",
|
| 9 |
+
"gate_proj",
|
| 10 |
+
"up_proj",
|
| 11 |
+
"down_proj"
|
| 12 |
+
],
|
| 13 |
+
"modules_to_save": [
|
| 14 |
+
"embed_tokens",
|
| 15 |
+
"lm_head"
|
| 16 |
+
],
|
| 17 |
+
"peft_type": "LORA",
|
| 18 |
+
"task_type": "CAUSAL_LM",
|
| 19 |
+
"lora_dropout": 0.05,
|
| 20 |
+
"bias": "none"
|
| 21 |
+
}
|
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57d50670de4275c79b0f36cbcfe63e7e3743a75deb8b1bf89a72f8b873291d83
|
| 3 |
+
size 4555174208
|
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/special_tokens_map.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<|begin_of_text|>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|end_of_text|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
}
|
| 16 |
+
}
|
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8636a6e43c7fcbd40a00130ca75d6177c337d841ddb312363d14fffbd577a6e
|
| 3 |
+
size 17307482
|
hgpt/humanml3d-x/lora/llama-3.1-nocot_maskinput_pkeep/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lora_merge.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# load_and_merge.py
|
| 2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
+
from peft import PeftModel
|
| 4 |
+
import torch
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
base_model_path = "YOUR_PATH_TO_LLAMA-3.1-8B"
|
| 8 |
+
lora_adapter_path = "YOUR_PATH_TO_LORA"
|
| 9 |
+
save_dir = "YOUR_SAVE_DIR"
|
| 10 |
+
|
| 11 |
+
os.makedirs(save_dir, exist_ok=True)
|
| 12 |
+
|
| 13 |
+
print("Loading base model...")
|
| 14 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 15 |
+
base_model_path,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
tokenizer = AutoTokenizer.from_pretrained(lora_adapter_path, legacy=True)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
base_model.resize_token_embeddings(len(tokenizer))
|
| 22 |
+
|
| 23 |
+
print("Loading LoRA adapter...")
|
| 24 |
+
peft_model = PeftModel.from_pretrained(base_model, lora_adapter_path)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
print("Merging...")
|
| 28 |
+
merged_model = peft_model.merge_and_unload()
|
| 29 |
+
breakpoint()
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
print("Saving merged model...")
|
| 33 |
+
merged_model.save_pretrained(save_dir)
|
| 34 |
+
tokenizer.save_pretrained(save_dir)
|
| 35 |
+
|
| 36 |
+
print(f"✅ 合并完成")
|