Skip to content

Allow video objects (np array etc.) in apply_chat_template (not just paths or urls) #36560

@FredrikNoren

Description

@FredrikNoren

Feature request

Currently it seems like it only supports { "type": "video", "path/url": ".."}.

The code seems to be made to allow numpy arrays, torch tensors and other things as values: https://github.com/huggingface/transformers/blob/main/src/transformers/image_utils.py#L851
But the video.startswith will always crash if anything other than a string is passed in

Motivation

I'd like to pass in videos from memory instead of writing them to disk first.

Your contribution

I can update the code to make it support video objects

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions