---
title: eval
---

<div class="python-reference">
<a id="fastvideo.entrypoints.cli.eval-classes"></a>
<a id="fastvideo.entrypoints.cli.eval-functions"></a>
<a id="fastvideo.entrypoints.cli.eval"></a>
<p><code>fastvideo eval</code> CLI: list registered eval metrics and run them
against a set of videos.</p>
<p>This is a thin wrapper around :mod:<code>fastvideo.eval</code>. Heavy lifting
(metric loading, GPU handling, batching) lives in
:func:<code>fastvideo.eval.create_evaluator</code>.</p>
<p>Examples::</p>
<pre><code>fastvideo eval list
fastvideo eval list --group vbench
fastvideo eval run --videos path/to/videos/*.mp4 \
    --metrics common.ssim --reference path/to/refs/
fastvideo eval run --videos clip.mp4 --metrics vbench.aesthetic_quality \
    --output scores.json
</code></pre>
<h2 id="fastvideo.entrypoints.cli.eval.CLISubcommand"><code>fastvideo.entrypoints.cli.eval.CLISubcommand</code></h2>
<pre class="doc-signature"><code>CLISubcommand()</code></pre>
<p>Base class for CLI subcommands</p>
<h3 id="fastvideo.entrypoints.cli.eval.CLISubcommand.cmd"><code>fastvideo.entrypoints.cli.eval.CLISubcommand.cmd</code></h3>
<pre class="doc-signature"><code>cmd(args: argparse.Namespace) -&gt; None</code></pre>
<p>Execute the command with the given arguments</p>
<h3 id="fastvideo.entrypoints.cli.eval.CLISubcommand.validate"><code>fastvideo.entrypoints.cli.eval.CLISubcommand.validate</code></h3>
<pre class="doc-signature"><code>validate(args: argparse.Namespace) -&gt; None</code></pre>
<p>Validate the arguments for this command</p>
<h3 id="fastvideo.entrypoints.cli.eval.CLISubcommand.subparser_init"><code>fastvideo.entrypoints.cli.eval.CLISubcommand.subparser_init</code></h3>
<pre class="doc-signature"><code>subparser_init(subparsers: argparse._SubParsersAction) -&gt; FlexibleArgumentParser</code></pre>
<p>Initialize the subparser for this command</p>
<h2 id="fastvideo.entrypoints.cli.eval.init_logger"><code>fastvideo.entrypoints.cli.eval.init_logger</code></h2>
<pre class="doc-signature"><code>init_logger(name: str) -&gt; _FastvideoLogger</code></pre>
<p>The main purpose of this function is to ensure that loggers are
retrieved in such a way that we can be sure the root fastvideo logger has
already been configured.</p>
<h2 id="fastvideo.entrypoints.cli.eval.FlexibleArgumentParser"><code>fastvideo.entrypoints.cli.eval.FlexibleArgumentParser</code></h2>
<pre class="doc-signature"><code>FlexibleArgumentParser(*args, **kwargs)</code></pre>
<p>ArgumentParser that allows both underscore and dash in names.</p>

<h3 id="fastvideo.entrypoints.cli.eval.FlexibleArgumentParser.parse_args"><code>fastvideo.entrypoints.cli.eval.FlexibleArgumentParser.parse_args</code></h3>
<pre class="doc-signature"><code>parse_args(args = None, namespace = None) -&gt; argparse.Namespace</code></pre>

<h3 id="fastvideo.entrypoints.cli.eval.FlexibleArgumentParser.parse_known_args"><code>fastvideo.entrypoints.cli.eval.FlexibleArgumentParser.parse_known_args</code></h3>
<pre class="doc-signature"><code>parse_known_args(args = None, namespace = None) -&gt; tuple&#91;argparse.Namespace, list&#91;str&#93;&#93;</code></pre>

<h2 id="fastvideo.entrypoints.cli.eval.EvalSubcommand"><code>fastvideo.entrypoints.cli.eval.EvalSubcommand</code></h2>
<pre class="doc-signature"><code>EvalSubcommand()</code></pre>
<p>The <code>eval</code> subcommand — entry point for the eval suite.</p>

<details><summary>Source</summary><pre><code>class EvalSubcommand(CLISubcommand):
    &quot;&quot;&quot;The ``eval`` subcommand — entry point for the eval suite.&quot;&quot;&quot;

    def __init__(self) -&gt; None:
        self.name = &quot;eval&quot;
        super().__init__()

    def cmd(self, args: argparse.Namespace) -&gt; None:
        action = getattr(args, &quot;eval_action&quot;, None)
        if action == &quot;list&quot;:
            _cmd_list(args)
        elif action == &quot;run&quot;:
            _cmd_run(args)
        elif action == &quot;v2a&quot;:
            _cmd_v2a(args)
        else:
            # Re-print help if no action was given.
            self._parser.print_help()  # type: ignore&#91;attr-defined&#93;

    def validate(self, args: argparse.Namespace) -&gt; None:
        action = getattr(args, &quot;eval_action&quot;, None)
        if action == &quot;v2a&quot;:
            if args.backend != &quot;av-benchmark&quot;:
                raise SystemExit(f&quot;Unsupported V2A evaluation backend: &#123;args.backend&#125;&quot;)
            return
        if action != &quot;run&quot;:
            return
        if not args.manifest and not args.videos and not args.audios:
            raise SystemExit(&quot;`fastvideo eval run` requires --manifest, --videos, or --audios&quot;)
        if args.manifest and (args.videos or args.audios or args.reference or args.reference_audio):
            raise SystemExit(&quot;--manifest cannot be combined with media path arguments&quot;)

    def subparser_init(self, subparsers: argparse._SubParsersAction) -&gt; FlexibleArgumentParser:
        eval_parser = subparsers.add_parser(
            &quot;eval&quot;,
            help=&quot;Run video and V2A evaluation metrics&quot;,
            usage=&quot;fastvideo eval &#123;list,run,v2a&#125; &#91;...&#93;&quot;,
        )
        sub = eval_parser.add_subparsers(dest=&quot;eval_action&quot;, required=False)

        # `eval list`
        list_p = sub.add_parser(&quot;list&quot;, help=&quot;List registered metrics&quot;)
        list_p.add_argument(&quot;--group&quot;, type=str, default=None, help=&quot;Filter to a metric group (e.g. &#x27;vbench&#x27;).&quot;)

        # `eval run`
        run_p = sub.add_parser(&quot;run&quot;, help=&quot;Evaluate videos against one or more metrics&quot;)
        run_p.add_argument(
            &quot;--manifest&quot;,
            type=str,
            default=None,
            help=&quot;JSON/JSONL canonical sample manifest (recommended for benchmarks).&quot;,
        )
        run_p.add_argument(&quot;--videos&quot;,
                           type=str,
                           nargs=&quot;+&quot;,
                           required=False,
                           help=&quot;Path, glob, or directory of generated videos.&quot;)
        run_p.add_argument(&quot;--audios&quot;,
                           type=str,
                           nargs=&quot;+&quot;,
                           required=False,
                           help=&quot;Path, glob, or directory of generated audio files.&quot;)
        run_p.add_argument(&quot;--reference&quot;,
                           type=str,
                           default=None,
                           help=&quot;Path / glob / dir of reference videos (for paired metrics).&quot;)
        run_p.add_argument(
            &quot;--reference-audio&quot;,
            type=str,
            nargs=&quot;+&quot;,
            default=None,
            help=&quot;Path, glob, or directory of reference audio files.&quot;,
        )
        run_p.add_argument(&quot;--metrics&quot;, type=str, default=&quot;all&quot;, help=&quot;Comma-separated metric names, or &#x27;all&#x27;.&quot;)
        run_p.add_argument(&quot;--device&quot;, type=str, default=&quot;cuda&quot;, help=&quot;Torch device (e.g. &#x27;cuda&#x27;, &#x27;cuda:0&#x27;, &#x27;cpu&#x27;).&quot;)
        run_p.add_argument(&quot;--num-gpus&quot;, type=int, default=1, help=&quot;Number of metric replicas for dataset evaluation.&quot;)
        run_p.add_argument(&quot;--compile&quot;, action=&quot;store_true&quot;, help=&quot;Compile supported metric models.&quot;)
        run_p.add_argument(
            &quot;--skip-missing-deps&quot;,
            action=&quot;store_true&quot;,
            help=&quot;Skip explicitly requested metrics whose optional dependencies are missing.&quot;,
        )
        run_p.add_argument(
            &quot;--extract-audio&quot;,
            nargs=&quot;?&quot;,
            const=True,
            default=False,
            help=&quot;Extract missing audio tracks; optionally provide a persistent cache directory.&quot;,
        )
        run_p.add_argument(&quot;--extract-workers&quot;, type=int, default=4)
        run_p.add_argument(
            &quot;--text-prompt&quot;,
            type=str,
            nargs=&quot;*&quot;,
            default=None,
            help=&quot;Prompt(s) for text-conditioned metrics. One per video.&quot;,
        )
        run_p.add_argument(&quot;--fps&quot;, type=float, default=None, help=&quot;Frame-rate annotation passed to fps-aware metrics.&quot;)
        run_p.add_argument(&quot;--output&quot;,
                           type=str,
                           default=None,
                           help=&quot;Write results as JSON to this path (default: stdout).&quot;)
        run_p.add_argument(
            &quot;--output-format&quot;,
            choices=(&quot;legacy&quot;, &quot;full&quot;),
            default=&quot;legacy&quot;,
            help=&quot;&#x27;full&#x27; includes corpus metrics and sample identities.&quot;,
        )

        # `eval v2a`: isolated corpus-level backends for video-to-audio.
        v2a_p = sub.add_parser(&quot;v2a&quot;, help=&quot;Evaluate V2A audio with a corpus benchmark backend&quot;)
        v2a_p.add_argument(&quot;--backend&quot;, choices=(&quot;av-benchmark&quot;, ), default=&quot;av-benchmark&quot;)
        v2a_p.add_argument(&quot;--audio-dir&quot;, required=True, help=&quot;Directory containing generated WAV/FLAC files.&quot;)
        v2a_p.add_argument(&quot;--gt-cache&quot;, required=True, help=&quot;Official ground-truth feature cache directory.&quot;)
        v2a_p.add_argument(
            &quot;--prediction-cache&quot;,
            default=None,
            help=&quot;Generated-audio feature cache (default: &lt;audio-dir&gt;/../av_benchmark_cache).&quot;,
        )
        v2a_p.add_argument(
            &quot;--output&quot;,
            default=None,
            help=&quot;Result JSON (default: &lt;audio-dir&gt;/../av_benchmark_results.json).&quot;,
        )
        v2a_p.add_argument(
            &quot;--python-executable&quot;,
            default=None,
            help=&quot;Python from an isolated av-benchmark environment.&quot;,
        )
        v2a_p.add_argument(&quot;--device&quot;, default=&quot;cuda&quot;)
        v2a_p.add_argument(&quot;--batch-size&quot;, type=int, default=32)
        v2a_p.add_argument(&quot;--num-workers&quot;, type=int, default=0)
        v2a_p.add_argument(&quot;--audio-length&quot;, type=float, default=8.0)
        v2a_p.add_argument(&quot;--recompute&quot;, action=&quot;store_true&quot;, help=&quot;Re-extract the prediction cache.&quot;)
        v2a_p.add_argument(&quot;--skip-video-related&quot;, action=&quot;store_true&quot;, help=&quot;Skip ImageBind and DeSync.&quot;)
        v2a_p.add_argument(&quot;--skip-clap&quot;, action=&quot;store_true&quot;, help=&quot;Skip LAION/MS CLAP extraction and scores.&quot;)
        v2a_p.add_argument(
            &quot;--align-prediction-keys&quot;,
            action=&quot;store_true&quot;,
            help=&quot;Align uniquely underscore-prefixed prediction ids to official GT cache ids.&quot;,
        )

        # Stash the parser so cmd() can re-print help on no-action.
        self._parser = eval_parser  # type: ignore&#91;attr-defined&#93;
        return cast(FlexibleArgumentParser, eval_parser)</code></pre></details>
<h3 id="fastvideo.entrypoints.cli.eval.EvalSubcommand.cmd"><code>fastvideo.entrypoints.cli.eval.EvalSubcommand.cmd</code></h3>
<pre class="doc-signature"><code>cmd(args: argparse.Namespace) -&gt; None</code></pre>

<details><summary>Source</summary><pre><code>def cmd(self, args: argparse.Namespace) -&gt; None:
    action = getattr(args, &quot;eval_action&quot;, None)
    if action == &quot;list&quot;:
        _cmd_list(args)
    elif action == &quot;run&quot;:
        _cmd_run(args)
    elif action == &quot;v2a&quot;:
        _cmd_v2a(args)
    else:
        # Re-print help if no action was given.
        self._parser.print_help()  # type: ignore&#91;attr-defined&#93;</code></pre></details>
<h3 id="fastvideo.entrypoints.cli.eval.EvalSubcommand.validate"><code>fastvideo.entrypoints.cli.eval.EvalSubcommand.validate</code></h3>
<pre class="doc-signature"><code>validate(args: argparse.Namespace) -&gt; None</code></pre>

<details><summary>Source</summary><pre><code>def validate(self, args: argparse.Namespace) -&gt; None:
    action = getattr(args, &quot;eval_action&quot;, None)
    if action == &quot;v2a&quot;:
        if args.backend != &quot;av-benchmark&quot;:
            raise SystemExit(f&quot;Unsupported V2A evaluation backend: &#123;args.backend&#125;&quot;)
        return
    if action != &quot;run&quot;:
        return
    if not args.manifest and not args.videos and not args.audios:
        raise SystemExit(&quot;`fastvideo eval run` requires --manifest, --videos, or --audios&quot;)
    if args.manifest and (args.videos or args.audios or args.reference or args.reference_audio):
        raise SystemExit(&quot;--manifest cannot be combined with media path arguments&quot;)</code></pre></details>
<h3 id="fastvideo.entrypoints.cli.eval.EvalSubcommand.subparser_init"><code>fastvideo.entrypoints.cli.eval.EvalSubcommand.subparser_init</code></h3>
<pre class="doc-signature"><code>subparser_init(subparsers: argparse._SubParsersAction) -&gt; FlexibleArgumentParser</code></pre>

<details><summary>Source</summary><pre><code>def subparser_init(self, subparsers: argparse._SubParsersAction) -&gt; FlexibleArgumentParser:
    eval_parser = subparsers.add_parser(
        &quot;eval&quot;,
        help=&quot;Run video and V2A evaluation metrics&quot;,
        usage=&quot;fastvideo eval &#123;list,run,v2a&#125; &#91;...&#93;&quot;,
    )
    sub = eval_parser.add_subparsers(dest=&quot;eval_action&quot;, required=False)

    # `eval list`
    list_p = sub.add_parser(&quot;list&quot;, help=&quot;List registered metrics&quot;)
    list_p.add_argument(&quot;--group&quot;, type=str, default=None, help=&quot;Filter to a metric group (e.g. &#x27;vbench&#x27;).&quot;)

    # `eval run`
    run_p = sub.add_parser(&quot;run&quot;, help=&quot;Evaluate videos against one or more metrics&quot;)
    run_p.add_argument(
        &quot;--manifest&quot;,
        type=str,
        default=None,
        help=&quot;JSON/JSONL canonical sample manifest (recommended for benchmarks).&quot;,
    )
    run_p.add_argument(&quot;--videos&quot;,
                       type=str,
                       nargs=&quot;+&quot;,
                       required=False,
                       help=&quot;Path, glob, or directory of generated videos.&quot;)
    run_p.add_argument(&quot;--audios&quot;,
                       type=str,
                       nargs=&quot;+&quot;,
                       required=False,
                       help=&quot;Path, glob, or directory of generated audio files.&quot;)
    run_p.add_argument(&quot;--reference&quot;,
                       type=str,
                       default=None,
                       help=&quot;Path / glob / dir of reference videos (for paired metrics).&quot;)
    run_p.add_argument(
        &quot;--reference-audio&quot;,
        type=str,
        nargs=&quot;+&quot;,
        default=None,
        help=&quot;Path, glob, or directory of reference audio files.&quot;,
    )
    run_p.add_argument(&quot;--metrics&quot;, type=str, default=&quot;all&quot;, help=&quot;Comma-separated metric names, or &#x27;all&#x27;.&quot;)
    run_p.add_argument(&quot;--device&quot;, type=str, default=&quot;cuda&quot;, help=&quot;Torch device (e.g. &#x27;cuda&#x27;, &#x27;cuda:0&#x27;, &#x27;cpu&#x27;).&quot;)
    run_p.add_argument(&quot;--num-gpus&quot;, type=int, default=1, help=&quot;Number of metric replicas for dataset evaluation.&quot;)
    run_p.add_argument(&quot;--compile&quot;, action=&quot;store_true&quot;, help=&quot;Compile supported metric models.&quot;)
    run_p.add_argument(
        &quot;--skip-missing-deps&quot;,
        action=&quot;store_true&quot;,
        help=&quot;Skip explicitly requested metrics whose optional dependencies are missing.&quot;,
    )
    run_p.add_argument(
        &quot;--extract-audio&quot;,
        nargs=&quot;?&quot;,
        const=True,
        default=False,
        help=&quot;Extract missing audio tracks; optionally provide a persistent cache directory.&quot;,
    )
    run_p.add_argument(&quot;--extract-workers&quot;, type=int, default=4)
    run_p.add_argument(
        &quot;--text-prompt&quot;,
        type=str,
        nargs=&quot;*&quot;,
        default=None,
        help=&quot;Prompt(s) for text-conditioned metrics. One per video.&quot;,
    )
    run_p.add_argument(&quot;--fps&quot;, type=float, default=None, help=&quot;Frame-rate annotation passed to fps-aware metrics.&quot;)
    run_p.add_argument(&quot;--output&quot;,
                       type=str,
                       default=None,
                       help=&quot;Write results as JSON to this path (default: stdout).&quot;)
    run_p.add_argument(
        &quot;--output-format&quot;,
        choices=(&quot;legacy&quot;, &quot;full&quot;),
        default=&quot;legacy&quot;,
        help=&quot;&#x27;full&#x27; includes corpus metrics and sample identities.&quot;,
    )

    # `eval v2a`: isolated corpus-level backends for video-to-audio.
    v2a_p = sub.add_parser(&quot;v2a&quot;, help=&quot;Evaluate V2A audio with a corpus benchmark backend&quot;)
    v2a_p.add_argument(&quot;--backend&quot;, choices=(&quot;av-benchmark&quot;, ), default=&quot;av-benchmark&quot;)
    v2a_p.add_argument(&quot;--audio-dir&quot;, required=True, help=&quot;Directory containing generated WAV/FLAC files.&quot;)
    v2a_p.add_argument(&quot;--gt-cache&quot;, required=True, help=&quot;Official ground-truth feature cache directory.&quot;)
    v2a_p.add_argument(
        &quot;--prediction-cache&quot;,
        default=None,
        help=&quot;Generated-audio feature cache (default: &lt;audio-dir&gt;/../av_benchmark_cache).&quot;,
    )
    v2a_p.add_argument(
        &quot;--output&quot;,
        default=None,
        help=&quot;Result JSON (default: &lt;audio-dir&gt;/../av_benchmark_results.json).&quot;,
    )
    v2a_p.add_argument(
        &quot;--python-executable&quot;,
        default=None,
        help=&quot;Python from an isolated av-benchmark environment.&quot;,
    )
    v2a_p.add_argument(&quot;--device&quot;, default=&quot;cuda&quot;)
    v2a_p.add_argument(&quot;--batch-size&quot;, type=int, default=32)
    v2a_p.add_argument(&quot;--num-workers&quot;, type=int, default=0)
    v2a_p.add_argument(&quot;--audio-length&quot;, type=float, default=8.0)
    v2a_p.add_argument(&quot;--recompute&quot;, action=&quot;store_true&quot;, help=&quot;Re-extract the prediction cache.&quot;)
    v2a_p.add_argument(&quot;--skip-video-related&quot;, action=&quot;store_true&quot;, help=&quot;Skip ImageBind and DeSync.&quot;)
    v2a_p.add_argument(&quot;--skip-clap&quot;, action=&quot;store_true&quot;, help=&quot;Skip LAION/MS CLAP extraction and scores.&quot;)
    v2a_p.add_argument(
        &quot;--align-prediction-keys&quot;,
        action=&quot;store_true&quot;,
        help=&quot;Align uniquely underscore-prefixed prediction ids to official GT cache ids.&quot;,
    )

    # Stash the parser so cmd() can re-print help on no-action.
    self._parser = eval_parser  # type: ignore&#91;attr-defined&#93;
    return cast(FlexibleArgumentParser, eval_parser)</code></pre></details>
<h2 id="fastvideo.entrypoints.cli.eval.cmd_init"><code>fastvideo.entrypoints.cli.eval.cmd_init</code></h2>
<pre class="doc-signature"><code>cmd_init() -&gt; list&#91;CLISubcommand&#93;</code></pre>

<details><summary>Source</summary><pre><code>def cmd_init() -&gt; list&#91;CLISubcommand&#93;:
    return &#91;EvalSubcommand()&#93;</code></pre></details>
</div>
