Run this model with HF Jobs

Run ambient-intelligence-labs/tempora-1 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 and TRL to fine-tune https://huggingface.co/ambient-intelligence-labs/tempora-1. 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/ambient-intelligence-labs/tempora-1 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.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/ambient-intelligence-labs/tempora-1. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/ambient-intelligence-labs/tempora-1. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Tempora-1

Code Blog Demo Discord

image

A temporal video segmentation model for general video and robotics. Give it a video and a plain-language instruction that says what counts as a segment; it returns the matching events in order as JSON, each with a start time, an end time, a short label and any metadata fields you ask for. This repo keeps its first name (tempora-27b); the model is Tempora-1.

Each model's best run on WGO-Bench:

image

Full result:

image

All rows, per-source scores and how each number is produced: results/wgo/RESULTS.md.

Serving with vLLM

Start the server:

docker run --gpus all --ipc=host -p 8000:8000 \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    -e HF_TOKEN \
    -e VLLM_MAX_MEDIA_REQUEST_DECODE_BYTES=8000000000 \
    vllm/vllm-openai:v0.33.0 \
    ambient-intelligence-labs/tempora-1 \
        --served-model-name tempora-1 \
        --max-num-batched-tokens 65536 \
        --limit-mm-per-prompt '{"image": 0, "video": 1}' \
        --trust-request-mm-kwargs \
        --reasoning-parser qwen3

Send a video (a 2-minute archival basketball newsreel; the server downloads it):

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
  "model": "tempora-1",
  "temperature": 0,
  "chat_template_kwargs": {"enable_thinking": true},
  "media_io_kwargs": {"video": {"fps": 3.0008, "backend": "torchcodec"}},
  "mm_processor_kwargs": {"do_sample_frames": false,
    "size": {"shortest_edge": 25296896, "longest_edge": 44269568}},
  "messages": [{"role": "user", "content": [
    {"type": "video_url", "video_url": {"url": "https://goambient.ai/assets/blog/video-chunker/ncaa_1963.mp4"}},
    {"type": "text", "text": "Instruction: Segment only the parts where gameplay is not shown: only the audience or cheerleaders are on screen.\nmetadata_fields: [\"description\"]\nReturn JSON: {\"chunks\":[{\"start\":sec,\"end\":sec,\"label\":...}]}"}
  ]}]
}'

The answer is in choices[0].message.content as {"chunks": [{"start", "end", "label", "metadata"}]}; the reasoning, with thinking on, is in reasoning_content. Put your own instruction in the text: Instruction: says what counts as a segment, Task: (optional) what the person or robot is doing, and metadata_fields the fields to fill per segment.

Video settings: compute them for each video

fps, shortest_edge and longest_edge in the request above are for this 128.8-second video. They make the server show the model its best configuration : 3 frames per second, at most 540 frames, and 64 to 112 visual tokens (65,536 to 114,688 pixels) per frame. For another video:

  • n = 3 ร— duration in seconds, at most 540, rounded down to an even number (If your hardware/setup supports >540, go for it)
  • fps = (n + 0.5) / duration (the 0.5 makes the server keep exactly n frames)
  • shortest_edge = 65536 ร— n and longest_edge = 114688 ร— n (pixel limits for the whole clip)

Don't reuse these values on a longer video, and don't leave out size. Too few pixels get spread over too many frames: the model can't read on-screen text and guesses names and labels.

This snippet computes them from the video and sends the same request:

VIDEO=https://goambient.ai/assets/blog/video-chunker/ncaa_1963.mp4
MAX_FRAMES=540   # frame cap; raise it only if your server limits allow (see below)
read FPS SMIN SMAX < <(ffprobe -v error -show_entries format=duration -of csv=p=0 "$VIDEO" | MAX_FRAMES=$MAX_FRAMES python3 -c '
import os, sys; d = float(sys.stdin.read()); n = int(min(max(3 * d, 4), int(os.environ["MAX_FRAMES"]))) // 2 * 2
print(f"{(n + 0.5) / d:.4f}", 65536 * n, 114688 * n)')

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d @- <<EOF
{
  "model": "tempora-1",
  "temperature": 0,
  "max_tokens": 32768,
  "chat_template_kwargs": {"enable_thinking": true},
  "media_io_kwargs": {"video": {"fps": $FPS, "backend": "torchcodec"}},
  "mm_processor_kwargs": {"do_sample_frames": false,
    "size": {"shortest_edge": $SMIN, "longest_edge": $SMAX}},
  "messages": [{"role": "user", "content": [
    {"type": "video_url", "video_url": {"url": "$VIDEO"}},
    {"type": "text", "text": "Instruction: Segment only the parts where gameplay is not shown: only the audience or cheerleaders are on screen.\nmetadata_fields: [\"description\"]\nReturn JSON: {\"chunks\":[{\"start\":sec,\"end\":sec,\"label\":...}]}"}
  ]}]
}
EOF

Values for common lengths:

Video length n fps shortest_edge longest_edge
30 s 90 3.0167 5,898,240 10,321,920
60 s 180 3.0083 11,796,480 20,643,840
2 min 360 3.0042 23,592,960 41,287,680
3 min or longer 540 540.5 / seconds 35,389,440 61,931,520

The Python client below does this for you.

Server flags

  • --max-num-batched-tokens 65536 also sets the vision cache; it fits 540-1024 frames. A request that fails with "exceeds the pre-allocated encoder cache size" needs a larger value (the default is 12,288).
  • VLLM_MAX_MEDIA_REQUEST_DECODE_BYTES: 540 decoded 1080p frames are about 3.4 GB; the default limit is about 0.7 GB.
  • --trust-request-mm-kwargs lets each request carry its video settings. It also lets any caller change them, so set --api-key on a server others can reach.

More frames for long videos. The model's default is 540 frames, so videos longer than 3 minutes are sampled below 3 fps (16 minutes: 0.55 fps) and short events can fall between frames. If your GPU has room, raise MAX_FRAMES and the server limits together. For longer videos, higher frames should give improved results.

Frame cap --max-num-batched-tokens VLLM_MAX_MEDIA_REQUEST_DECODE_BYTES
540 (trained) 32768 4000000000
1080 65536 8000000000
2160 131072 16000000000

On WGO-Bench the vLLM server scores 0.47 to 0.49 seg F1 against 0.51 offline; use offline inference for benchmark numbers.

Serving with SGLang

docker run --gpus all --ipc=host -p 30000:30000 \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    -e HF_TOKEN \
    lmsysorg/sglang:v0.5.23 \
    python3 -m sglang.launch_server \
        --model-path ambient-intelligence-labs/tempora-1 \
        --host 0.0.0.0 --port 30000 \
        --served-model-name tempora-1 \
        --context-length 65536 \
        --reasoning-parser qwen3 \
        --limit-mm-data-per-request '{"video": 1}' \
        --mem-fraction-static 0.7 \
        --mm-process-config '{
          "video": {
            "fps": 3, "min_frames": 4, "max_frames": 540,
            "min_pixels": 65536, "max_pixels": 114688,
            "size": {"shortest_edge": 4096, "longest_edge": 61931520}
          }
        }'

SGLang sets the video settings once for the whole server, so requests are the first curl above sent to port 30000 without media_io_kwargs and mm_processor_kwargs. In --mm-process-config:

  • fps, min_frames, max_frames: 3 frames per second, at least 4 and at most 540 frames.
  • min_pixels, max_pixels: 64 to 112 visual tokens per frame.
  • size: a cap on the whole clip (114688 ร— 540) with a near-zero floor, so the per-frame limits apply at every length. To allow more frames, raise max_frames, set longest_edge to 114688 ร— max_frames, and raise --context-length.

SGLang cannot match the training frame sampling exactly (0.48 seg F1 on WGO-Bench). Keep concurrency at 2 for long HD video.

Python API

Install the package from the GitHub repo. It applies the frame sampling and prompt format the model was trained with; other frame rates or resolutions shift its timestamps.

git clone https://github.com/ambient-intelligence-hq/tempora-1 && cd tempora-1
pip install -e ".[infer]"     # offline inference with vLLM (one GPU with >= 80 GB)
pip install -e ".[client]"    # only talk to a running vLLM / SGLang server

Usage:

from video_chunker import VideoChunker

if __name__ == "__main__":                   # vLLM starts its engine in a new process; keep the guard
    vc = VideoChunker()                      # ambient-intelligence-labs/tempora-1, thinking on
    res = vc.chunk("talk.mp4",
                   instruction="Segment by the talk sections",
                   fields=["person_speaking", "slide_title"])
    for c in res.chunks:
        print(f"{c.start:7.1f} {c.end:7.1f}  {c.label}  {c.metadata}")

Command line:

video-chunker robot.mp4 --instruction "Separate segments for picking up and for placing each object." \
    --task "put the cups in the sink" --no-thinking --out chunks.json

vLLM:

from video_chunker.client import ChunkerClient

res = ChunkerClient("http://localhost:8000/v1").chunk("talk.mp4", instruction="Segment by the talk sections")

SGLang:

from video_chunker.client import ChunkerClient

res = ChunkerClient("http://localhost:30000/v1", server="sglang").chunk("talk.mp4", instruction="Segment by the talk sections")

Details: docs/serving.md.

Writing instructions

  • Instruction: what counts as one chunk, in your own words ("one segment per slide", "the steps of the procedure").
  • Task (optional): what the person or robot is trying to do.
  • Fields (optional): names of metadata fields to fill for every chunk, with optional descriptions.
  • Thinking is on by default and improves boundaries on long first-person video, at about 2.5 times the generation time. Turn it off for throughput.
  • Videos up to 3 minutes are seen at the full 3 frames per second (540 frames); longer videos are sampled more sparsely.
Downloads last month
136
Safetensors
Model size
27B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for ambient-intelligence-labs/tempora-1

Base model

Qwen/Qwen3.8-27B
Finetuned
(1,158)
this model
Quantizations
1 model

Spaces using ambient-intelligence-labs/tempora-1 2

Evaluation results