Instructions to use nvidia/MambaVision-B-21K with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/MambaVision-B-21K with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="nvidia/MambaVision-B-21K", trust_remote_code=True) pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoModelForImageClassification model = AutoModelForImageClassification.from_pretrained("nvidia/MambaVision-B-21K", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_mambavision.py
Browse filesThere seems to be a typo in torch.nn.cross_entropy. This seems to be torch.nn.functional.cross_entropy
- modeling_mambavision.py +1 -1
modeling_mambavision.py
CHANGED
|
@@ -778,6 +778,6 @@ class MambaVisionModelForImageClassification(PreTrainedModel):
|
|
| 778 |
def forward(self, tensor, labels=None):
|
| 779 |
logits = self.model(tensor)
|
| 780 |
if labels is not None:
|
| 781 |
-
loss = torch.nn.cross_entropy(logits, labels)
|
| 782 |
return {"loss": loss, "logits": logits}
|
| 783 |
return {"logits": logits}
|
|
|
|
| 778 |
def forward(self, tensor, labels=None):
|
| 779 |
logits = self.model(tensor)
|
| 780 |
if labels is not None:
|
| 781 |
+
loss = torch.nn.functional.cross_entropy(logits, labels)
|
| 782 |
return {"loss": loss, "logits": logits}
|
| 783 |
return {"logits": logits}
|