Yuchan
commited on
Update Inference.py
Browse files- Inference.py +4 -4
Inference.py
CHANGED
|
@@ -186,15 +186,15 @@ model = ReLM(
|
|
| 186 |
d_model=256,
|
| 187 |
n_layers=1
|
| 188 |
)
|
| 189 |
-
|
|
|
|
|
|
|
| 190 |
model.load_weights('/kaggle/working/model.weights.h5')
|
| 191 |
print("모델 가중치 로드 완료!")
|
| 192 |
# =======================
|
| 193 |
# 6) 추론 함수 (기존 코드 유지)
|
| 194 |
# 더미 인풋으로 모델 초기화
|
| 195 |
-
|
| 196 |
-
_ = model(dummy_input)
|
| 197 |
-
model.summary()
|
| 198 |
|
| 199 |
def generate_text_topp(model, prompt, max_len=512, max_gen=512, p=0.9, temperature=0.8, min_len=20):
|
| 200 |
model_input = text_to_ids(f"<start> {prompt}")
|
|
|
|
| 186 |
d_model=256,
|
| 187 |
n_layers=1
|
| 188 |
)
|
| 189 |
+
dummy_input = np.zeros((1, max_len), dtype=np.int32)
|
| 190 |
+
_ = model(dummy_input)
|
| 191 |
+
model.summary()
|
| 192 |
model.load_weights('/kaggle/working/model.weights.h5')
|
| 193 |
print("모델 가중치 로드 완료!")
|
| 194 |
# =======================
|
| 195 |
# 6) 추론 함수 (기존 코드 유지)
|
| 196 |
# 더미 인풋으로 모델 초기화
|
| 197 |
+
|
|
|
|
|
|
|
| 198 |
|
| 199 |
def generate_text_topp(model, prompt, max_len=512, max_gen=512, p=0.9, temperature=0.8, min_len=20):
|
| 200 |
model_input = text_to_ids(f"<start> {prompt}")
|