File size: 841 Bytes
401cf69 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# モデルをローカルにダウンロードして保存
from transformers import AutoImageProcessor, AutoModelForImageClassification
import os
model_name = "krmin/mahjong_soul_vision"
local_model_path = "./vision_transformer_local"
print(f"モデルをダウンロード中: {model_name}")
print(f"保存先: {local_model_path}")
# モデルとプロセッサをダウンロード
processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(model_name)
# ローカルに保存
print("ローカルに保存中...")
processor.save_pretrained(local_model_path)
model.save_pretrained(local_model_path)
print("✓ 完了!")
print(f"\n次回からは以下のように読み込めます:")
print(f'pipe = pipeline("image-classification", model="{local_model_path}", device=device)')
|