我正在尝试使用以下代码从 HF加载此语义分割模型:
from transformers import pipeline
model = pipeline("image-segmentation", model="Carve/u2net-universal", device="cpu")
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
OSError: tamnvcc/isnet-general-use does not appear to have a file named config.json. Checkout 'https://huggingface.co/tamnvcc/isnet-general-use/main' for available files.
Run Code Online (Sandbox Code Playgroud)
是否可以在不提供 config.json 文件的情况下从 HuggingFace 加载模型?
我还尝试通过以下方式加载模型:
id2label = {0: "background", 1: "target"}
label2id = {"background": 0, "target": 1}
image_processor = AutoImageProcessor.from_pretrained("Carve/u2net-universal")
model = AutoModelForSemanticSegmentation("Carve/u2net-universal", id2label=id2label, label2id=label2id)
Run Code Online (Sandbox Code Playgroud)
但遇到了同样的错误。
python machine-learning computer-vision huggingface-transformers