Create setup_checkpoint.py
Browse files- setup_checkpoint.py +15 -0
setup_checkpoint.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
# Kiểm tra xem file checkpoint có tồn tại hay không
|
4 |
+
checkpoint_path = "path/to/your/checkpoint/file.ckpt"
|
5 |
+
if not os.path.exists(checkpoint_path):
|
6 |
+
print("File checkpoint không tồn tại.")
|
7 |
+
exit()
|
8 |
+
|
9 |
+
# Tải model và tokenizer từ Hugging Face
|
10 |
+
from transformers import AutoModelForGenerativePreTraining, AutoTokenizer
|
11 |
+
|
12 |
+
model = AutoModelForGenerativePreTraining.from_pretrained(checkpoint_path)
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained("visd-tdnm")
|
14 |
+
|
15 |
+
print("Model và tokenizer đã được tải thành công.")
|