File size: 450 Bytes
29964ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from transformers import AutoModelForCausalLM, AutoTokenizer

# モデル名を指定
model_name = "./"

# モデルとトークナイザーを読み込む
model = AutoModelForCausalLM.from_pretrained(model_name)
# tokenizer = AutoTokenizer.from_pretrained(model_name)

# モデルの状態ディクショナリを取得
state_dict = model.state_dict()

# weightキーを表示
for key in state_dict.keys():
    if "weight" in key:
        print(key)