TouchNight commited on
Commit
f18c961
1 Parent(s): 69dd97f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - IlyaGusev/gemma-2-9b-it-abliterated
4
+ ---
5
+ Created with:
6
+ ```
7
+ from transformers import AutoModelForCausalLM
8
+ import torch
9
+
10
+ # 加载模型并解除共享
11
+ model = AutoModelForCausalLM.from_pretrained("IlyaGusev/gemma-2-9b-it-abliterated", tie_word_embeddings=False)
12
+
13
+ # 解除共享的 lm_head 和 embed_tokens 权重
14
+ model.lm_head.weight.data = model.model.embed_tokens.weight.data.clone()
15
+
16
+ # 将模型转换为 bf16 格式
17
+ model = model.to(dtype=torch.bfloat16)
18
+
19
+ # 指定保存路径
20
+ untied_model_dir = "mergekit/output"
21
+
22
+ # 保存解除共享且为 bf16 格式的模型
23
+ model.save_pretrained(untied_model_dir)
24
+ model.config.save_pretrained(untied_model_dir)
25
+ ```
26
+ I didn't copy tokenizer from the original model, do it yourself if you want.