Update README.md
Browse files
README.md
CHANGED
@@ -37,17 +37,17 @@ fine-tuned versions on a task that interests you.
|
|
37 |
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
38 |
|
39 |
```python
|
40 |
-
from transformers import
|
41 |
import torch
|
42 |
from datasets import load_dataset
|
43 |
|
44 |
dataset = load_dataset("huggingface/cats-image")
|
45 |
image = dataset["test"]["image"][0]
|
46 |
|
47 |
-
|
48 |
model = ConvNextForImageClassification.from_pretrained("facebook/convnext-base-384-22k-1k")
|
49 |
|
50 |
-
inputs =
|
51 |
|
52 |
with torch.no_grad():
|
53 |
logits = model(**inputs).logits
|
|
|
37 |
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
38 |
|
39 |
```python
|
40 |
+
from transformers import ConvNextImageProcessor, ConvNextForImageClassification
|
41 |
import torch
|
42 |
from datasets import load_dataset
|
43 |
|
44 |
dataset = load_dataset("huggingface/cats-image")
|
45 |
image = dataset["test"]["image"][0]
|
46 |
|
47 |
+
processor = ConvNextImageProcessor.from_pretrained("facebook/convnext-base-384-22k-1k")
|
48 |
model = ConvNextForImageClassification.from_pretrained("facebook/convnext-base-384-22k-1k")
|
49 |
|
50 |
+
inputs = processor(image, return_tensors="pt")
|
51 |
|
52 |
with torch.no_grad():
|
53 |
logits = model(**inputs).logits
|