Youku-mPLUG: Ein 10 Millionen großer chinesischer Video-Sprach-Pre-Training-Datensatz und Benchmarks. Download-Link HIER
Papier
Wir veröffentlichen den öffentlich größten chinesischen Datensatz in hochwertiger Videosprache (10 Millionen) mit dem Namen Youku-mPLUG , der von einer bekannten chinesischen Video-Sharing-Website namens Youku mit strengen Kriterien für Sicherheit, Vielfalt und Qualität gesammelt wird.
Beispiele für Videoclips und Titel im vorgeschlagenen Youku-mPLUG-Datensatz.
Wir stellen drei verschiedene Downstream-Multimodal-Video-Benchmark-Datensätze zur Verfügung, um die Fähigkeiten vorab trainierter Modelle zu messen. Zu den 3 verschiedenen Aufgaben gehören:
Der Datensatz enthält insgesamt 10 Millionen Videos, die von hoher Qualität sind und in 20 Superkategorien bzw. 45 Kategorien verteilt sind.
Die Verteilung der Kategorien im Youku-mPLUG-Datensatz.
Über diesen Link können Sie alle Videos und Anmerkungsdateien herunterladen
Hinweis: Aufgrund eines Fehlers in megatron_util ist es nach der Installation von megatron_util erforderlich, conda/envs/youku/lib/python3.10/site-packages/megatron_util/initialize.py durch initialize.py im aktuellen Verzeichnis zu ersetzen.
conda env create -f environment.yml
conda activate youku
pip install megatron_util==1.3.0 -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
# For caption evaluation
apt-get install default-jre
Zuerst sollten Sie den GPT-3 1.3B & 2.7B Checkpoint von Modelscope herunterladen. Das vorab trainierte Modell kann hier (1.3B) und hier (2.7B) heruntergeladen werden.
Ausführen des Vortrainings von mPLUG-Video als:
exp_name = 'pretrain/gpt3_1.3B/pretrain_gpt3_freezeGPT_youku_v0'
PYTHONPATH = $ PYTHONPATH :. /
python - m torch . distributed . launch - - nproc_per_node = 8 - - master_addr = $ MASTER_ADDR
- - master_port = $ MASTER_PORT
- - nnodes = $ WORLD_SIZE
- - node_rank = $ RANK
- - use_env run_pretrain_distributed_gpt3 . py
- - config . / configs / ${ exp_name }. yaml
- - output_dir . / output / ${ exp_name }
- - enable_deepspeed
- - bf16
2 > & 1 | tee . / output / ${ exp_name } / train . log
Zur Durchführung einer nachgelagerten Feinabstimmung. Als Beispiel nehmen wir die Videokategorievorhersage:
exp_name = 'cls/cls_gpt3_1.3B_youku_v0_sharp_2'
PYTHONPATH = $ PYTHONPATH :. /
python - m torch . distributed . launch - - nproc_per_node = 8 - - master_addr = $ MASTER_ADDR
- - master_port = $ MASTER_PORT
- - nnodes = $ WORLD_SIZE
- - node_rank = $ RANK
- - use_env downstream / run_cls_distributed_gpt3 . py
- - config . / configs / ${ exp_name }. yaml
- - output_dir . / output / ${ exp_name }
- - enable_deepspeed
- - resume path / to / 1_3 B_mp_rank_00_model_states . pt
- - bf16
2 > & 1 | tee . / output / ${ exp_name } / train . log
Nachfolgend zeigen wir die Ergebnisse der Validierungssätze als Referenz.
Wir erstellen das mPLUG-Video-Modell basierend auf mPLUG-Owl. Um das Modell zu verwenden, sollten Sie zunächst das mPLUG-Owl-Repo klonen als
git clone https://github.com/X-PLUG/mPLUG-Owl.git
cd mPLUG-Owl/mPLUG-Owl
Der anweisungsgesteuerte Checkpoint ist auf HuggingFace verfügbar. Informationen zur Feinabstimmung des Modells finden Sie im mPLUG-Owl Repo. Um eine Videoinferenz durchzuführen, können Sie den folgenden Code verwenden:
import torch
from mplug_owl_video . modeling_mplug_owl import MplugOwlForConditionalGeneration
from transformers import AutoTokenizer
from mplug_owl_video . processing_mplug_owl import MplugOwlImageProcessor , MplugOwlProcessor
pretrained_ckpt = 'MAGAer13/mplug-youku-bloomz-7b'
model = MplugOwlForConditionalGeneration . from_pretrained (
pretrained_ckpt ,
torch_dtype = torch . bfloat16 ,
device_map = { '' : 0 },
)
image_processor = MplugOwlImageProcessor . from_pretrained ( pretrained_ckpt )
tokenizer = AutoTokenizer . from_pretrained ( pretrained_ckpt )
processor = MplugOwlProcessor ( image_processor , tokenizer )
# We use a human/AI template to organize the context as a multi-turn conversation.
# <|video|> denotes an video placehold.
prompts = [
'''The following is a conversation between a curious human and AI assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
Human: <|video|>
Human: 视频中的女人在干什么?
AI: ''' ]
video_list = [ 'yoga.mp4' ]
# generate kwargs (the same in transformers) can be passed in the do_generate()
generate_kwargs = {
'do_sample' : True ,
'top_k' : 5 ,
'max_length' : 512
}
inputs = processor ( text = prompts , videos = video_list , num_frames = 4 , return_tensors = 'pt' )
inputs = { k : v . bfloat16 () if v . dtype == torch . float else v for k , v in inputs . items ()}
inputs = { k : v . to ( model . device ) for k , v in inputs . items ()}
with torch . no_grad ():
res = model . generate ( ** inputs , ** generate_kwargs )
sentence = tokenizer . decode ( res . tolist ()[ 0 ], skip_special_tokens = True )
print ( sentence )
Wenn Sie diesen Datensatz für Ihre Forschung nützlich finden, ziehen Sie bitte die Zitierung unseres Artikels in Betracht.
@misc { xu2023youku_mplug ,
title = { Youku-mPLUG: A 10 Million Large-scale Chinese Video-Language Dataset for Pre-training and Benchmarks } ,
author = { Haiyang Xu, Qinghao Ye, Xuan Wu, Ming Yan, Yuan Miao, Jiabo Ye, Guohai Xu, Anwen Hu, Yaya Shi, Chenliang Li, Qi Qian, Que Maofei, Ji Zhang, Xiao Zeng, Fei Huang } ,
year = { 2023 } ,
eprint = { 2306.04362 } ,
archivePrefix = { arXiv } ,
primaryClass = { cs.CL }
}