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