Update 추론.py
Browse files
추론.py
CHANGED
|
@@ -4,7 +4,7 @@ import sentencepiece as spm
|
|
| 4 |
from tensorflow.keras import layers, Model
|
| 5 |
|
| 6 |
# 1. 토크나이저 로드
|
| 7 |
-
TOKENIZER_PATH =
|
| 8 |
sp = spm.SentencePieceProcessor(TOKENIZER_PATH)
|
| 9 |
pad_id = sp.piece_to_id("<pad>") if sp.piece_to_id("<pad>") != -1 else 0
|
| 10 |
bos_id = sp.piece_to_id("<s>") if sp.piece_to_id("<s>") != -1 else 1
|
|
@@ -137,7 +137,7 @@ dummy_input = tf.zeros((1, 1), dtype=tf.int32)
|
|
| 137 |
_ = lm(dummy_input)
|
| 138 |
|
| 139 |
# 3. 가중치 로드
|
| 140 |
-
lm.load_weights(
|
| 141 |
print("✅ 모델 가중치 로드 완료")
|
| 142 |
|
| 143 |
|
|
|
|
| 4 |
from tensorflow.keras import layers, Model
|
| 5 |
|
| 6 |
# 1. 토크나이저 로드
|
| 7 |
+
TOKENIZER_PATH = "tokenizer.model"
|
| 8 |
sp = spm.SentencePieceProcessor(TOKENIZER_PATH)
|
| 9 |
pad_id = sp.piece_to_id("<pad>") if sp.piece_to_id("<pad>") != -1 else 0
|
| 10 |
bos_id = sp.piece_to_id("<s>") if sp.piece_to_id("<s>") != -1 else 1
|
|
|
|
| 137 |
_ = lm(dummy_input)
|
| 138 |
|
| 139 |
# 3. 가중치 로드
|
| 140 |
+
lm.load_weights("openlm.weights.h5")
|
| 141 |
print("✅ 모델 가중치 로드 완료")
|
| 142 |
|
| 143 |
|