This repository contains the 6B model of the paper InternVideo2 in stage 2.
Fonte do modelo
Descrição da fonte
This repository contains the 6B model of the paper InternVideo2 in stage 2.
Code: https://github.com/OpenGVLab/InternVideo/tree/main/InternVideo2/multi_modality
Please refer to
Fontes
1 fonteVerificado 18 de set.
Artefatos de modelo
13 artefatosTrechos de fonte
2 trechosimport cv2
from transformers import AutoModel
from modeling_internvideo2 import (retrieve_text, vid2tensor, _frame_from_video,)
model = AutoModel.from_pretrained("OpenGVLab/InternVideo2-Stage2_6B", trust_remote_code=True).eval()
video = cv2.VideoCapture('example1.mp4')
frames = [x for x in _frame_from_video(video)]
text_candidates = ["A playful dog and its owner wrestle in the snowy yard, chasing each other with joyous abandon.",
"A man in a gray coat walks through the snowy landscape, pulling a sleigh loaded with toys.",
"A person dressed in a blue jacket shovels the snow-covered pavement outside their house.",
"A cat excitedly runs through the yard, chasing a rabbit.",
"A person bundled up in a blanket walks through the snowy landscape, enjoying the serene winter scenery."]
texts, probs = retrieve_text(frames, text_candidates, model=model, topk=5)
for t, p in zip(texts, probs):
print(f'text: {t} ~ prob: {p:.4f}')
vidtensor = vid2tensor('example1.mp4', fnum=4)
feat = model.get_vid_feat(vidtensor)
model-00003-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 bc1ad5944716…5639 · Hugging Face
model-00004-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 bd4479e81e91…5f78 · Hugging Face
Baixarmodel-00005-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 f16ff3ed45cc…5eae · Hugging Face
Baixarmodel-00006-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 5b4fadad100d…6923 · Hugging Face
Baixarmodel-00007-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 0d32dbcb9d7c…caa3 · Hugging Face
Baixarmodel-00008-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 8f990c3a412c…38f4 · Hugging Face
Baixarmodel-00009-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 e29811441d6a…5272 · Hugging Face
Baixarmodel-00010-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 57e01270ed6a…353b · Hugging Face
Baixarmodel-00011-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 8d4ef0dede04…7777 · Hugging Face
Baixarmodel-00012-of-00013.safetensors
safetensors · 1,83 GB · SHA-256 29a0162c3608…b4b1 · Hugging Face
Baixarmodel-00013-of-00013.safetensors
safetensors · 1,85 GB · SHA-256 6328c13ba3af…f42e · Hugging Face
Baixar--- license: mit pipeline_tag: video-classification --- ## Introduction This repository contains the 6B model of the paper [InternVideo2](https://arxiv.org/pdf/2403.15377) in stage 2. Code: https://github.com/OpenGVLab/InternVideo/tree/main/InternVideo2/multi_modality ## 🚀 Installation Please refer to https://github.com/OpenGVLab/InternVideo/blob/main/InternVideo2/multi_modality/INSTALL.md ## Usage ```python import cv2 from transformers import AutoModel from modeling_internvideo2 import (retrieve_text, vid2tensor, _frame_from_video,) model = AutoModel.from_pretrained("OpenGVLab/InternVideo2-Stage2_6B", trust_remote_code=True).eval() video = cv2.VideoCapture('example1.mp4') frames = [x for x in _frame_from_video(video)] text_candidates = ["A playful dog and its owner wrestle in the snowy yard, chasing each other with joyous abandon.", "A man in a gray coat walks through the snowy landscape, pulling a sleigh loaded with toys.", "A person dressed in a blue jacket shovels the snow-covered pavement outside their house.", "A cat excitedly runs through the yard, chasing a rabbit.", "A person bundled up in a blanket walks through the snowy landscape, enjoying the serene winter scenery."] texts, probs = retrieve_text(frames, text_candidates, model=model, topk=5) for t, p in zip(texts, probs): print(f'text: {t} ~ prob: {p:.4f}') vidtensor = vid2tensor('example1.mp4', fnum=4) feat = model.get_vid_feat(vidtensor) ```
Source context: 522 downloads · 1 likes · Pipeline video-classification · Repo OpenGVLab/InternVideo2-Stage2_6B