Text-to-Image
Diffusers
vietnam
sd
ViSD-TDNM / setup_checkpoint.py
TDN-M's picture
Create setup_checkpoint.py
0a6f300 verified
import os
# Kiểm tra xem file checkpoint có tồn tại hay không
checkpoint_path = "path/to/your/checkpoint/file.ckpt"
if not os.path.exists(checkpoint_path):
print("File checkpoint không tồn tại.")
exit()
# Tải model và tokenizer từ Hugging Face
from transformers import AutoModelForGenerativePreTraining, AutoTokenizer
model = AutoModelForGenerativePreTraining.from_pretrained(checkpoint_path)
tokenizer = AutoTokenizer.from_pretrained("visd-tdnm")
print("Model và tokenizer đã được tải thành công.")