HFValidationError: Repo id must be in the form ‘repo_name‘ or ‘namespace/repo_name‘: ‘/root/vicuna-7

大家好

本文主要介绍HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/root/vicuna-7b-fastchat'. Use `repo_type` argument if needed.分析和解决,希望能够有所帮助。

问题描述:在测试vicuna-7b模型,推理时报错HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/root/vicuna-7b-fastchat'. Use `repo_type` argument if needed

具体错误

分析:没有找到模型

解决:修改模型路径,我的是模型名称输错了,请仔细核对模型路径

报错提醒:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /root/.local/conda/envs/fastchat/lib/python3.9/runpy.py:197 in _run_module_as_main               │
│                                                                                                  │
│   194 │   main_globals = sys.modules["__main__"].__dict__                                        │
│   195 │   if alter_argv:                                                                         │
│   196 │   │   sys.argv[0] = mod_spec.origin                                                      │
│ ❱ 197 │   return _run_code(code, main_globals, None,                                             │
│   198 │   │   │   │   │    "__main__", mod_spec)                                                 │
│   199                                                                                            │
│   200 def run_module(mod_name, init_globals=None,                                                │
│                                                                                                  │
│ /root/.local/conda/envs/fastchat/lib/python3.9/runpy.py:87 in _run_code                          │
│                                                                                                  │
│    84 │   │   │   │   │      __loader__ = loader,                                                │
│    85 │   │   │   │   │      __package__ = pkg_name,                                             │
│    86 │   │   │   │   │      __spec__ = mod_spec)                                                │
│ ❱  87 │   exec(code, run_globals)                                                                │
│    88 │   return run_globals                                                                     │
│    89                                                                                            │
│    90 def _run_module_code(code, init_globals=None,                                              │
│                                                                                                  │
│ /root/FastChat-main/fastchat/serve/cli.py:239 in <module>                                        │
│                                                                                                  │
│   236 │   │   help="Print useful debug information (e.g., prompts)",                             │
│   237 │   )                                                                                      │
│   238 │   args = parser.parse_args()                                                             │
│ ❱ 239 │   main(args)                                                                             │
│   240                                                                                            │
│                                                                                                  │
│ /root/FastChat-main/fastchat/serve/cli.py:176 in main                                            │
│                                                                                                  │
│   173 │   else:                                                                                  │
│   174 │   │   raise ValueError(f"Invalid style for console: {args.style}")                       │
│   175 │   try:                                                                                   │
│ ❱ 176 │   │   chat_loop(                                                                         │
│   177 │   │   │   args.model_path,                                                               │
│   178 │   │   │   args.device,                                                                   │
│   179 │   │   │   args.num_gpus,                                                                 │
│                                                                                                  │
│ /root/FastChat-main/fastchat/serve/inference.py:288 in chat_loop                                 │
│                                                                                                  │
│   285 │   debug: bool,                                                                           │
│   286 ):                                                                                         │
│   287 │   # Model                                                                                │
│ ❱ 288 │   model, tokenizer = load_model(                                                         │
│   289 │   │   model_path,                                                                        │
│   290 │   │   device,                                                                            │
│   291 │   │   num_gpus,                                                                          │
│                                                                                                  │
│ /root/FastChat-main/fastchat/model/model_adapter.py:201 in load_model                            │
│                                                                                                  │
│   198 │                                                                                          │
│   199 │   # Load model                                                                           │
│   200 │   adapter = get_model_adapter(model_path)                                                │
│ ❱ 201 │   model, tokenizer = adapter.load_model(model_path, kwargs)                              │
│   202 │                                                                                          │
│   203 │   if (device == "cuda" and num_gpus == 1 and not cpu_offloading) or device == "mps":     │
│   204 │   │   model.to(device)                                                                   │
│                                                                                                  │
│ /root/FastChat-main/fastchat/model/model_adapter.py:345 in load_model                            │
│                                                                                                  │
│   342 │                                                                                          │
│   343 │   def load_model(self, model_path: str, from_pretrained_kwargs: dict):                   │
│   344 │   │   revision = from_pretrained_kwargs.get("revision", "main")                          │
│ ❱ 345 │   │   tokenizer = AutoTokenizer.from_pretrained(                                         │
│   346 │   │   │   model_path, use_fast=self.use_fast_tokenizer, revision=revision                │
│   347 │   │   )                                                                                  │
│   348 │   │   model = AutoModelForCausalLM.from_pretrained(                                      │
│                                                                                                  │
│ /root/.local/conda/envs/fastchat/lib/python3.9/site-packages/transformers/models/auto/tokenizati │
│ on_auto.py:642 in from_pretrained                                                                │
│                                                                                                  │
│   639 │   │   │   return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *input   │
│   640 │   │                                                                                      │
│   641 │   │   # Next, let's try to use the tokenizer_config file to get the tokenizer class.     │
│ ❱ 642 │   │   tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs)   │
│   643 │   │   if "_commit_hash" in tokenizer_config:                                             │
│   644 │   │   │   kwargs["_commit_hash"] = tokenizer_config["_commit_hash"]                      │
│   645 │   │   config_tokenizer_class = tokenizer_config.get("tokenizer_class")                   │
│                                                                                                  │
│ /root/.local/conda/envs/fastchat/lib/python3.9/site-packages/transformers/models/auto/tokenizati │
│ on_auto.py:486 in get_tokenizer_config                                                           │
│                                                                                                  │
│   483 │   tokenizer_config = get_tokenizer_config("tokenizer-test")                              │
│   484 │   ```"""                                                                                 │
│   485 │   commit_hash = kwargs.get("_commit_hash", None)                                         │
│ ❱ 486 │   resolved_config_file = cached_file(                                                    │
│   487 │   │   pretrained_model_name_or_path,                                                     │
│   488 │   │   TOKENIZER_CONFIG_FILE,                                                             │
│   489 │   │   cache_dir=cache_dir,                                                               │
│                                                                                                  │
│ /root/.local/conda/envs/fastchat/lib/python3.9/site-packages/transformers/utils/hub.py:409 in    │
│ cached_file                                                                                      │
│                                                                                                  │
│    406 │   user_agent = http_user_agent(user_agent)                                              │
│    407 │   try:                                                                                  │
│    408 │   │   # Load from URL or cache if already cached                                        │
│ ❱  409 │   │   resolved_file = hf_hub_download(                                                  │
│    410 │   │   │   path_or_repo_id,                                                              │
│    411 │   │   │   filename,                                                                     │
│    412 │   │   │   subfolder=None if len(subfolder) == 0 else subfolder,                         │
│                                                                                                  │
│ /root/.local/conda/envs/fastchat/lib/python3.9/site-packages/huggingface_hub/utils/_validators.p │
│ y:110 in _inner_fn                                                                               │
│                                                                                                  │
│   107 │   │   │   kwargs.items(),  # Kwargs values                                               │
│   108 │   │   ):                                                                                 │
│   109 │   │   │   if arg_name in ["repo_id", "from_id", "to_id"]:                                │
│ ❱ 110 │   │   │   │   validate_repo_id(arg_value)                                                │
│   111 │   │   │                                                                                  │
│   112 │   │   │   elif arg_name == "token" and arg_value is not None:                            │
│   113 │   │   │   │   has_token = True                                                           │
│                                                                                                  │
│ /root/.local/conda/envs/fastchat/lib/python3.9/site-packages/huggingface_hub/utils/_validators.p │
│ y:158 in validate_repo_id                                                                        │
│                                                                                                  │
│   155 │   │   raise HFValidationError(f"Repo id must be a string, not {type(repo_id)}: '{repo_   │
│   156 │                                                                                          │
│   157 │   if repo_id.count("/") > 1:                                                             │
│ ❱ 158 │   │   raise HFValidationError(                                                           │
│   159 │   │   │   "Repo id must be in the form 'repo_name' or 'namespace/repo_name':"            │
│   160 │   │   │   f" '{repo_id}'. Use `repo_type` argument if needed."                           │
│   161 │   │   )                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/root/vicuna-7b-fastchat'. Use 
`repo_type` argument if needed.

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值