huggingface 國內如何連接

cache_dir='E:\\huggingface_model_cache\\'
import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
os.environ["HF_DATASETS_CACHE"] = cache_dir
os.environ["HF_HOME"] = "/disk/cache/"
os.environ["HUGGINGFACE_HUB_CACHE"] = cache_dir
os.environ["TRANSFORMERS_CACHE"] = cache_dir



from transformers import pipeline
import os

pipe = pipeline('sentiment-analysis')
print(pipe('今天真高興'))
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章