INNER CODE UNIT · Python

prepare_inference_input

OpenVGLab/OmniLottie · app.py:180

def prepare_inference_input(processor, messages, device):
    text_input = processor.apply_chat_template(
        messages, tokenize=False, add_generation_prompt=True
    )

    image_inputs, video_inputs = process_vision_info(messages)

    inputs = processor(
        text=[text_input],
        images=image_inputs if image_inputs else None,
        videos=video_inputs if video_inputs else None,
        padding=False,
        return_tensors="pt"
    )

    input_ids = inputs['input_ids']
    attention_mask = inputs['attention_mask']
    target_len = 1500

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…