Instructions to use nvidia/mit-b0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/mit-b0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="nvidia/mit-b0") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("nvidia/mit-b0") model = AutoModelForImageClassification.from_pretrained("nvidia/mit-b0") - Inference
- Notebooks
- Google Colab
- Kaggle
Example of loading pretrained model from local directory only
#3
by tungts - opened
I am trying to containerize and fine-tune SegFormer model so I want to load the pre-trained from local folder only but this code SegformerForSemanticSegmentation.from_pretrained( pretrained_model_name_or_path=PATH, local_files_only=True, num_labels=num_classes, ) give me error huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/ellen/pretrained/mit-b0'. Use 'repo_type' argument if needed.
Found the solution, the PATH should be the absolute path os.path.join(os.path.dirname(__file__), RELATIVE_FOLDER_PATH)