huggingface_hub 安装部署问题汇总
目录
解决方法,修改Model:
pip install huggingface_hub
jsonnano系统 yolo报错:
class Model(nn.Module, PyTorchModelHubMixin, repo_url="https://github.com/ultralytics/ultralytics", pipeline_tag="object-detection", license="agpl-3.0"):
Installing backend dependencies ... errorERROR: Command errored out with exit status 1:command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-3zkfga5a/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- puccinialincwd: NoneComplete output (2 lines):ERROR: Could not find a version that satisfies the requirement puccinialin (from versions: none)ERROR: No matching distribution found for puccinialin----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-3zkfga5a/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- puccinialin Check the logs for full command output.
解决方法,修改Model:
class Model(nn.Module): # 只继承 nn.Module,移除 PyTorchModelHubMixindef __init__(self,model: Union[str, Path] = "yolo11n.pt",task: str = None,verbose: bool = False,) -> None:# 只调用 nn.Module 的 __init__nn.Module.__init__(self)self.callbacks = callbacks.get_default_callbacks()self.predictor = None # reuse predictorself.model = None # model objectself.trainer = None # trainer objectself.ckpt = {} # if loaded from *.ptself.cfg = None # if loaded from *.yamlself.ckpt_path = Noneself.overrides = {} # overrides for trainer objectself.metrics = None # validation/training metricsself.session = None # HUB session - 可以保留但不再使用self.task = task # task typemodel = str(model).strip()# 移除或注释掉 HUB 模型检查部分# if self.is_hub_model(model):# # Fetch model from HUB# checks.check_requirements("hub-sdk>=0.0.12")# session = HUBTrainingSession.create_session(model)# model = session.model_file# if session.train_args: # training sent from HUB# self.session = session# Check if Triton Server modelif self.is_triton_model(model):self.model_name = self.model = modelself.overrides["task"] = task or "detect" # set `task=detect` if not explicitly setreturn# Load or create new YOLO modelif Path(model).suffix in {".yaml", ".yml"}:self._new(model, task=task, verbose=verbose)else:self._load(model, task=task)