---
title: base
---

<div class="python-reference">
<a id="fastvideo.eval.datasets.base-classes"></a>
<a id="fastvideo.eval.datasets.base.PromptDataset-functions"></a>
<a id="fastvideo.eval.datasets.base"></a>
<p>Prompt-corpus datasets.</p>
<p>A :class:<code>PromptDataset</code> is an iterable of <em>sample dicts</em> describing the
prompts and conditions for a benchmark. Each sample is a plain dict —
no dataclass, no schema enforcement — that flows directly into both
generation (<code>VideoGenerator.generate_video(**sample)</code>) and scoring
(<code>Evaluator.evaluate(**eval_kwargs)</code>). The runner picks well-known
keys (<code>prompt</code>, <code>n_samples</code>, <code>dimensions</code>, <code>auxiliary_info</code>,
...) and passes the rest through.</p>
<p>This matches the surrounding FastVideo style:</p>
<ul>
<li>:class:<code>fastvideo.dataset.validation_dataset.ValidationDataset</code> yields dicts.</li>
<li>:meth:<code>fastvideo.VideoGenerator.generate_video</code> consumes <code>**kwargs</code>.</li>
<li>:meth:<code>fastvideo.eval.Evaluator.evaluate</code> consumes <code>**kwargs</code>.</li>
</ul>
<p>To add a new benchmark:</p>
<ol>
<li>Subclass :class:<code>PromptDataset</code>, populate <code>self._rows</code> with dicts in
   <code>__init__</code>.</li>
<li>Decorate with <code>@register_dataset("my_bench")</code>.</li>
</ol>
<p>Convention for <code>auxiliary_info</code>: a <em>flat</em> dict of metric-keyed values
(e.g. <code>&#123;"color": "red"&#125;</code>). Benchmarks with nested aux schemas (VBench's
<code>&#123;dim: &#123;key: val&#125;&#125;</code>) flatten at load time so every consumer sees the
same shape.</p>
<h2 id="fastvideo.eval.datasets.base.Sample"><code>fastvideo.eval.datasets.base.Sample</code></h2>
<pre class="doc-signature"><code>Sample()</code></pre>
<p>Documented schema for a row yielded by :class:<code>PromptDataset</code>.</p>
<p>Only <code>prompt</code> is required. Extra keys beyond these are forwarded to
the runner's eval-kwargs builder verbatim, so action-conditioned or
audio-bearing benchmarks can add their own fields without changing
the base class.</p>
<details><summary>Source</summary><pre><code>class Sample(TypedDict, total=False):
    &quot;&quot;&quot;Documented schema for a row yielded by :class:`PromptDataset`.

    Only ``prompt`` is required. Extra keys beyond these are forwarded to
    the runner&#x27;s eval-kwargs builder verbatim, so action-conditioned or
    audio-bearing benchmarks can add their own fields without changing
    the base class.
    &quot;&quot;&quot;
    prompt: str
    n_samples: int
    dimensions: list&#91;str&#93;
    auxiliary_info: dict
    image_path: str
    reference_video: str</code></pre></details>
<h2 id="fastvideo.eval.datasets.base.PromptDataset"><code>fastvideo.eval.datasets.base.PromptDataset</code></h2>
<pre class="doc-signature"><code>PromptDataset()</code></pre>
<p>Iterable corpus of sample dicts. Subclasses populate <code>self._rows</code>.</p>

<details><summary>Source</summary><pre><code>class PromptDataset:
    &quot;&quot;&quot;Iterable corpus of sample dicts. Subclasses populate ``self._rows``.&quot;&quot;&quot;

    name: str = &quot;&quot;
    description: str = &quot;&quot;
    supports_dimensions: bool = False
    requires_reference_image: bool = False
    requires_reference_video: bool = False

    def __init__(self) -&gt; None:
        self._rows: list&#91;dict&#93; = &#91;&#93;

    def __iter__(self) -&gt; Iterator&#91;dict&#93;:
        return iter(self._rows)

    def __len__(self) -&gt; int:
        return len(self._rows)

    def __getitem__(self, i: int) -&gt; dict:
        return self._rows&#91;i&#93;

    def by_dimension(self) -&gt; dict&#91;str, list&#91;dict&#93;&#93;:
        &quot;&quot;&quot;Group samples by dimension. A multi-dim sample appears under each.&quot;&quot;&quot;
        out: dict&#91;str, list&#91;dict&#93;&#93; = &#123;&#125;
        for s in self._rows:
            for d in s.get(&quot;dimensions&quot;, ()):
                out.setdefault(d, &#91;&#93;).append(s)
        return out</code></pre></details>
<h3 id="fastvideo.eval.datasets.base.PromptDataset.by_dimension"><code>fastvideo.eval.datasets.base.PromptDataset.by_dimension</code></h3>
<pre class="doc-signature"><code>by_dimension() -&gt; dict&#91;str, list&#91;dict&#93;&#93;</code></pre>
<p>Group samples by dimension. A multi-dim sample appears under each.</p>
<details><summary>Source</summary><pre><code>def by_dimension(self) -&gt; dict&#91;str, list&#91;dict&#93;&#93;:
    &quot;&quot;&quot;Group samples by dimension. A multi-dim sample appears under each.&quot;&quot;&quot;
    out: dict&#91;str, list&#91;dict&#93;&#93; = &#123;&#125;
    for s in self._rows:
        for d in s.get(&quot;dimensions&quot;, ()):
            out.setdefault(d, &#91;&#93;).append(s)
    return out</code></pre></details>
</div>
