fix code snippet in model card (#2)
- fix code snippet in model card (b0d8688ea485cafceaa5233f8018a3d067b29b36) - Update README.md (0dca5362a3365155b15753a58c70150a55c5d0cd) Co-authored-by: Fatih <fcakyon@users.noreply.huggingface.co>
This commit is contained in:
parent
f74b6fa84d
commit
420a31456f
|
@ -20,16 +20,16 @@ You can use the raw model for video classification into one of the 400 possible
|
||||||
Here is how to use this model to classify a video:
|
Here is how to use this model to classify a video:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from transformers import TimesformerFeatureExtractor, TimesformerForVideoClassification
|
from transformers import AutoImageProcessor, TimesformerForVideoClassification
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
video = list(np.random.randn(8, 3, 224, 224))
|
video = list(np.random.randn(16, 3, 448, 448))
|
||||||
|
|
||||||
feature_extractor = TimesformerFeatureExtractor.from_pretrained("facebook/timesformer-hr-finetuned-k400")
|
processor = AutoImageProcessor.from_pretrained("facebook/timesformer-hr-finetuned-k400")
|
||||||
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-k400")
|
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-hr-finetuned-k400")
|
||||||
|
|
||||||
inputs = feature_extractor(video, return_tensors="pt")
|
inputs = processor(images=video, return_tensors="pt")
|
||||||
|
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
outputs = model(**inputs)
|
outputs = model(**inputs)
|
||||||
|
|
Loading…
Reference in New Issue