解决 python 中的 huggingface_hub

解决 python 中的 huggingface_hub.utils._validators.HFValidationError Repo id must be in the form repo_name or name 问题

在使用 python 的 huggingface_hub 库时,有时候会遇到类似于“huggingface_hub.utils._validators.HFValidationError Repo id must be in the form repo_name or name”的错误提示。这个错误的原因是在传入库的 ID 时格式不正确导致的,我们可以通过对 ID 进行修改来解决这个问题。

首先,让我们来看一个简单的例子:

from huggingface_hub import hf_hub_url, HfFolder, cached_download, hf_hub_id


# 加载模型
model_id = 'username/repo_name/model

你可能感兴趣的:(python,前端,数据库)