Video-Text-to-Text
Transformers
Safetensors
English
qwen2
text-generation
Action
Video
MQA
multimodal
MLLMs
LLaVAction
text-generation-inference
Run this model with HF Jobs
Run MLAdaptiveIntelligence/LLaVAction-0.5B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/MLAdaptiveIntelligence/LLaVAction-0.5B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/MLAdaptiveIntelligence/LLaVAction-0.5B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use MLAdaptiveIntelligence/LLaVAction-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MLAdaptiveIntelligence/LLaVAction-0.5B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MLAdaptiveIntelligence/LLaVAction-0.5B") model = AutoModelForCausalLM.from_pretrained("MLAdaptiveIntelligence/LLaVAction-0.5B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files25 unmodified lines26272829303132333435363738394041424344457 unmodified lines53545556575810 unmodified lines69707172737475767778798081828384858687888915 unmodified lines10510610710810911025 unmodified lines- **Point of Contact**: [Mackenzie Mathis](https://people.epfl.ch/mackenzie.mathis)- **Languages**: English-## Use### Intended useThe model was trained on EPIC-KITCHENS-100-MQA. It's intended to be used on videos that are similar to EPIC-KITCHENS-100.**Feel free to share your generations in the Community tab!**### GenerationWe provide the simple generation process for using our model. For more details, you could refer to Github.```python!pip install llavactionfrom llavaction.model.builder import load_pretrained_modelfrom llavaction.mm_utils import get_model_name_from_path, process_images, tokenizer_image_tokenfrom llavaction.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN, IGNORE_INDEX7 unmodified linesfrom decord import VideoReader, cpuimport numpy as npwarnings.filterwarnings("ignore")def load_video(video_path, max_frames_num,fps=1,force_sample=False):if max_frames_num == 0:return np.zeros((1, 336, 336, 3))10 unmodified linesspare_frames = vr.get_batch(frame_idx).asnumpy()# import pdb;pdb.set_trace()return spare_frames,frame_time,video_timepretrained = "MLAdaptiveIntelligence/LLaVAction-0.5B"model_name = "llava_qwen"device = "cuda"device_map = "auto"tokenizer, model, image_processor, max_length = load_pretrained_model(pretrained, None, model_name, torch_dtype="bfloat16", device_map=device_map) # Add any other thing you want to pass in llava_model_argsmodel.eval()video_path = "XXXX"max_frames_num = 64video,frame_time,video_time = load_video(video_path, max_frames_num, 1, force_sample=True)video = image_processor.preprocess(video, return_tensors="pt")["pixel_values"].cuda().to(torch.bfloat16)video = [video]conv_template = "qwen_1_5" # Make sure you use correct chat template for different modelstime_instruction = f"The video lasts for {video_time:.2f} seconds, and {len(video[0])} frames are uniformly sampled from it. "perspective_prompt = "You are seeing this video from egocentric view and you are the person. Your hands are sometimes interacting with objects. What action are you doing?"task_prompt = "Describe in details what you see from the video frames."question = DEFAULT_IMAGE_TOKEN + f"\n{time_instruction}\n{perspective_prompt} {task_prompt}"conv = copy.deepcopy(conv_templates[conv_template])conv.append_message(conv.roles[0], question)15 unmodified lines## Training### Model- **Architecture**: SO400M + Qwen225 unmodified lines2627282930313233343536373839404142437 unmodified lines51525354555657585960616263646510 unmodified lines7677787980818283848586878889909192939415 unmodified lines11011111211311411511611725 unmodified lines- **Point of Contact**: [Mackenzie Mathis](https://people.epfl.ch/mackenzie.mathis)- **Languages**: English-## Useage### Intended useThe model was trained on EPIC-KITCHENS-100-MQA. It's intended to be used on videos that are similar to EPIC-KITCHENS-100.### GenerationWe provide the simple generation process for using our model. For more details, you could refer to Github.```python!pip install llavactionfrom llavaction.model.builder import load_pretrained_modelfrom llavaction.mm_utils import get_model_name_from_path, process_images, tokenizer_image_tokenfrom llavaction.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN, IGNORE_INDEX7 unmodified linesfrom decord import VideoReader, cpuimport numpy as npwarnings.filterwarnings("ignore")#Your video (it assumes an egocentric view point)video_path = "XXXX"#These are the prompts we trained with, but you can test others:perspective_prompt = "You are seeing this video from egocentric view and you are the person. Your hands are sometimes interacting with objects. What action are you doing?"task_prompt = "Describe in details what you see from the video frames."def load_video(video_path, max_frames_num,fps=1,force_sample=False):if max_frames_num == 0:return np.zeros((1, 336, 336, 3))10 unmodified linesspare_frames = vr.get_batch(frame_idx).asnumpy()# import pdb;pdb.set_trace()return spare_frames,frame_time,video_timepretrained = "MLAdaptiveIntelligence/LLaVAction-0.5B"model_name = "llava_qwen"device = "cuda"device_map = "auto"tokenizer, model, image_processor, max_length = load_pretrained_model(pretrained, None, model_name, torch_dtype="bfloat16", device_map=device_map) # Add any other thing you want to pass in llava_model_argsmodel.eval()max_frames_num = 64video,frame_time,video_time = load_video(video_path, max_frames_num, 1, force_sample=True)video = image_processor.preprocess(video, return_tensors="pt")["pixel_values"].cuda().to(torch.bfloat16)video = [video]conv_template = "qwen_1_5" # Make sure you use correct chat template for different modelstime_instruction = f"The video lasts for {video_time:.2f} seconds, and {len(video[0])} frames are uniformly sampled from it. "question = DEFAULT_IMAGE_TOKEN + f"\n{time_instruction}\n{perspective_prompt} {task_prompt}"conv = copy.deepcopy(conv_templates[conv_template])conv.append_message(conv.roles[0], question)15 unmodified lines## TrainingSee Ye et al. 2025### Model- **Architecture**: SO400M + Qwen2
README.md+14-7