tests
¶
Modules¶
fastvideo.tests.api
¶
Modules¶
fastvideo.tests.api.test_compat_translation
¶
Tests for fastvideo.api.compat translation helpers covering the
typed CompileConfig + PipelineSelection.vae_tiling surfaces promoted in
PR 6.
Classes¶
fastvideo.tests.api.test_compat_translation.TestCompileConfigRoundTrip
¶typed CompileConfig -> FastVideoArgs.torch_compile_kwargs
reconstruction drops None typed fields and merges extras.
fastvideo.tests.api.test_compat_translation.TestLegacyLtx2VaeTilingTranslation
¶ltx2_vae_tiling flat kwarg promotes to
generator.pipeline.vae_tiling; reverse direction emits the
legacy name back to FastVideoArgs.
fastvideo.tests.api.test_compat_translation.TestLegacyTextEncoderCompileTranslation
¶enable_torch_compile_text_encoder flat kwarg promotes to
generator.engine.compile.text_encoder_enabled; reverse direction
emits the legacy name back onto the FastVideoArgs kwargs dict so
realtime-runtime consumers can read it before FastVideoArgs filters
unknown fields.
fastvideo.tests.api.test_compat_translation.TestLegacyTorchCompileKwargsTranslation
¶Legacy torch_compile_kwargs={...} gets split across the four
first-class :class:CompileConfig fields and anything unknown falls
into extras.
fastvideo.tests.api.test_ltx2_continuation
¶
Tests for the typed LTX-2 continuation state.
Covers:
- round-trip through :class:
ContinuationState(inline and blob-backed) - payload is JSON-serializable (Dynamo RPC / HTTP client constraint)
- kind / schema_version validation on deserialization
- compat-layer validation (known kinds, payload shape)
- round-trip through :func:
request_to_sampling_paramattaches the state to the resulting :class:SamplingParamwithout losing fidelity
Attributes¶
Classes¶
fastvideo.tests.api.test_ltx2_continuation.TestBlobIndirection
¶Large tensors live in the :class:BlobStore instead of the payload.
fastvideo.tests.api.test_ltx2_continuation.TestBlobIndirection.test_blob_id_held_when_store_unavailable
¶Deserializing without a blob store preserves the blob id so the caller can fetch it later.
Source code in fastvideo/tests/api/test_ltx2_continuation.py
fastvideo.tests.api.test_ltx2_continuation.TestCompatLayerWireUp
¶The public compat layer accepts request.state without reverting to NotImplementedError and attaches it to the SamplingParam path.
fastvideo.tests.api.test_ltx2_continuation.TestRoundTrip
¶Round-trip through :class:ContinuationState preserves all fields.
fastvideo.tests.api.test_ltx2_continuation.TestRoundTrip.test_bf16_audio_latents_preserved
¶safetensors serialization must preserve bf16 dtype (numpy has no bf16, so a raw-bytes path would silently promote).
Source code in fastvideo/tests/api/test_ltx2_continuation.py
fastvideo.tests.api.test_ltx2_continuation.TestValidation
¶Invalid payloads error cleanly.
Modules¶
fastvideo.tests.api.test_ltx2_gpu_pool_translation
¶
gpu_pool-style flat-kwarg integration tests.
Mirrors the load_kwargs dict that the FastVideo-internal
ui/ltx2-streaming/server/gpu_pool.py passes to
VideoGenerator.from_pretrained(**load_kwargs) and asserts that the
public typed GeneratorConfig surface (introduced across PRs 0-6)
can represent it end-to-end, with no fields silently falling through
to pipeline.experimental.
This is the parity guard PR 7.6 depends on: the public gpu_pool
upstream must be able to construct a typed GeneratorConfig without
knowing any legacy LTX-2 kwarg name, and downstream Dynamo
(FastVideoArgGroup) must be able to do the same.
Classes¶
fastvideo.tests.api.test_ltx2_gpu_pool_translation.TestCompileExtrasPreserved
¶Additional torch.compile kwargs beyond the four typed fields
round-trip through CompileConfig.extras.
fastvideo.tests.api.test_ltx2_gpu_pool_translation.TestGpuPoolForwardTranslation
¶gpu_pool flat kwargs -> typed GeneratorConfig.
fastvideo.tests.api.test_ltx2_gpu_pool_translation.TestGpuPoolForwardTranslation.test_no_experimental_leakage
¶Every gpu_pool kwarg should have a typed home — nothing should
silently fall through to pipeline.experimental.
Source code in fastvideo/tests/api/test_ltx2_gpu_pool_translation.py
fastvideo.tests.api.test_ltx2_gpu_pool_translation.TestGpuPoolReverseTranslation
¶typed GeneratorConfig -> FastVideoArgs kwargs reproduces the original gpu_pool flat-kwarg shape.
This is what lets PR 7.6 wire the public gpu_pool through
generator_config_to_fastvideo_args without the runtime noticing.
fastvideo.tests.api.test_ltx2_gpu_pool_translation.TestGpuPoolReverseTranslation.test_no_stray_refine_dict
¶preset_overrides.refine must flatten to ltx2_refine_* kwargs
rather than landing as a nested refine kwarg that
FastVideoArgs doesn't understand.
Source code in fastvideo/tests/api/test_ltx2_gpu_pool_translation.py
fastvideo.tests.api.test_ltx2_gpu_pool_translation.TestRefineFlattenCoversAllTypedFields
¶Every field on LTX2Refine{Preset,Stage}Override must survive the round-trip through preset_overrides.refine back to ltx2_refine_* kwargs. Guards against the hardcoded-key-tuple regression where image_crf / video_position_offset_sec silently dropped.
fastvideo.tests.api.test_ltx2_stage_overrides
¶
fastvideo.tests.api.test_presets
¶
Classes¶
fastvideo.tests.api.test_presets.TestPresetCountIntegrity
¶ fastvideo.tests.api.test_presets.TestPresetDefaultTypes
¶Preset defaults values must match the types on
:class:SamplingParam. Assigning None to a typed-str field
(e.g. negative_prompt) breaks downstream stages that assert the
runtime type — see the CFG branch in
pipelines/stages/text_encoding.py:81.
fastvideo.tests.api.test_presets.TestPresetDefaultTypes.test_ltx2_cfg_defaults_are_off
¶SamplingParam's LTX-2 CFG class defaults must be 1.0 (CFG
off). ForwardBatch.__post_init__ force-enables
do_classifier_free_guidance when either
ltx2_cfg_scale_video or ltx2_cfg_scale_audio is != 1.0,
so any non-1.0 default silently forces CFG on for every model
family that doesn't explicitly override these fields. Guard
against the regression that surfaced as the TurboDiffusion I2V
SSIM crash (text_encoding.py:81 assertion on
negative_prompt).
Source code in fastvideo/tests/api/test_presets.py
fastvideo.tests.api.test_presets.TestWanPresets
¶Verify the Wan presets registered from registry.py.
Functions¶
fastvideo.tests.conftest
¶
Functions¶
fastvideo.tests.conftest.distributed_setup
¶
Fixture to set up and tear down the distributed environment for tests.
This ensures proper cleanup even if tests fail.
Source code in fastvideo/tests/conftest.py
fastvideo.tests.performance
¶
Modules¶
fastvideo.tests.performance.test_inference_performance
¶
Config-driven inference performance tests.
Benchmark configs live in .buildkite/performance-benchmarks/tests/*.json. Each JSON file defines model params, generation kwargs, run config, and per-device thresholds. This test module auto-discovers all configs and parametrizes a single test function over them.
Classes¶
Functions¶
fastvideo.tests.performance.test_inference_performance.test_inference_performance
¶Measure generation latency and peak GPU memory, assert against device-aware thresholds.
Source code in fastvideo/tests/performance/test_inference_performance.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
fastvideo.tests.ssim
¶
Modules¶
fastvideo.tests.ssim.conftest
¶
Functions¶
fastvideo.tests.ssim.conftest.pytest_collection_modifyitems
¶Optionally keep only tests with a matching model_id parameter.
Source code in fastvideo/tests/ssim/conftest.py
fastvideo.tests.ssim.reference_videos_cli
¶
Functions¶
fastvideo.tests.ssim.reference_videos_cli.ensure_reference_videos_available
¶ensure_reference_videos_available(*, local_dir: Path | None = None, repo_id: str | None = None, repo_type: str | None = None, quality_tier: str = DEFAULT_OUTPUT_QUALITY_TIER) -> bool
Return True if downloaded from HF, False if already present locally.
Source code in fastvideo/tests/ssim/reference_videos_cli.py
fastvideo.tests.ssim.test_gamecraft_similarity
¶
SSIM regression test for HunyuanGameCraft (T2V and I2V).
Generates a video with deterministic seed and camera trajectory, then compares against a device-specific reference video via MS-SSIM.
Reference videos must be pre-generated and stored under
reference_videos/
To create initial reference videos, run this test once and copy the generated videos into the appropriate reference folder.
Classes¶
Functions¶
fastvideo.tests.ssim.test_gamecraft_similarity.test_gamecraft_i2v_similarity
¶Generate an I2V video with GameCraft and compare to reference via SSIM.
Source code in fastvideo/tests/ssim/test_gamecraft_similarity.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
fastvideo.tests.ssim.test_gamecraft_similarity.test_gamecraft_t2v_similarity
¶Generate a T2V video with GameCraft and compare to reference via SSIM.
Source code in fastvideo/tests/ssim/test_gamecraft_similarity.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
fastvideo.tests.ssim.test_gen3c_similarity
¶
SSIM regression test for GEN3C video generation.
Compares newly generated GEN3C videos against device-specific reference videos using MS-SSIM to detect quality regressions across code changes.
Usage
Requires 1+ GPU and reference videos.¶
pytest fastvideo/tests/ssim/test_gen3c_similarity.py -v
Environment variables
GEN3C_MODEL_PATH - Diffusers-format GEN3C model path/repo id. Default: FastVideo/GEN3C-Cosmos-7B-Diffusers (local converted path also supported)
Classes¶
Functions¶
fastvideo.tests.ssim.test_gen3c_similarity.test_gen3c_inference_similarity
¶Generate a GEN3C video and compare against the reference using MS-SSIM.
Source code in fastvideo/tests/ssim/test_gen3c_similarity.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
fastvideo.tests.ssim.test_lingbot_similarity
¶
fastvideo.tests.ssim.test_longcat_similarity
¶
SSIM-based similarity tests for LongCat video generation.
Tests three LongCat modes:
- T2V (Text-to-Video): 480p video from text prompt
- I2V (Image-to-Video): 480p video from image + text prompt
- VC (Video Continuation): 480p video continuation from input video + text prompt
Sampling parameters are derived from: - examples/inference/basic/basic_longcat_t2v.py - examples/inference/basic/basic_longcat_i2v.py - examples/inference/basic/basic_longcat_vc.py
Note: num_inference_steps is reduced for CI speed (4 steps vs 50 in examples).
Classes¶
Functions¶
fastvideo.tests.ssim.test_longcat_similarity.test_longcat_i2v_similarity
¶Test LongCat I2V inference and compare output to reference videos using SSIM.
Parameters derived from examples/inference/basic/basic_longcat_i2v.py
Source code in fastvideo/tests/ssim/test_longcat_similarity.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
fastvideo.tests.ssim.test_longcat_similarity.test_longcat_t2v_similarity
¶Test LongCat T2V inference and compare output to reference videos using SSIM.
Parameters derived from examples/inference/basic/basic_longcat_t2v.py
Source code in fastvideo/tests/ssim/test_longcat_similarity.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
fastvideo.tests.ssim.test_longcat_similarity.test_longcat_vc_similarity
¶Test LongCat VC (Video Continuation) inference and compare output to reference videos using SSIM.
Parameters derived from examples/inference/basic/basic_longcat_vc.py
Source code in fastvideo/tests/ssim/test_longcat_similarity.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |
fastvideo.tests.ssim.test_ltx2_similarity
¶
SSIM-based similarity test for LTX-2 distilled text-to-video.
Parameters derived from examples/inference/basic/basic_ltx2_distilled.py,
with resolution + num_inference_steps reduced to keep GPU CI runtime
bounded. Full-quality variant (via --ssim-full-quality) falls back
to the ltx2_distilled preset defaults.
fastvideo.tests.ssim.test_matrixgame_similarity
¶
Classes¶
Functions¶
fastvideo.tests.ssim.test_matrixgame_similarity.test_matrixgame_similarity
¶Test that runs inference with different parameters and compares the output to reference videos using SSIM.
Source code in fastvideo/tests/ssim/test_matrixgame_similarity.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
fastvideo.tests.utils
¶
Functions¶
fastvideo.tests.utils.compare_folders
¶
Compare videos with the same filename between reference_folder and generated_folder
Example usage:
results = compare_folders(reference_folder, generated_folder,
args.use_ms_ssim)
for video_name, ssim_value in results.items():
if ssim_value is not None:
print(
f"{video_name}: {ssim_value[0]:.4f}, Min SSIM: {ssim_value[1]:.4f}, Max SSIM: {ssim_value[2]:.4f}"
)
else:
print(f"{video_name}: Error during comparison")
valid_ssims = [v for v in results.values() if v is not None]
if valid_ssims:
avg_ssim = np.mean([v[0] for v in valid_ssims])
print(f"
Average SSIM across all videos: {avg_ssim:.4f}") else: print(" No valid SSIM values to average")
Source code in fastvideo/tests/utils.py
fastvideo.tests.utils.compute_video_ssim_torchvision
¶
Compute SSIM between two videos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video1_path
|
Path to the first video. |
required | |
video2_path
|
Path to the second video. |
required | |
use_ms_ssim
|
Whether to use Multi-Scale Structural Similarity(MS-SSIM) instead of SSIM. |
True
|
Source code in fastvideo/tests/utils.py
fastvideo.tests.utils.write_ssim_results
¶
write_ssim_results(output_dir, ssim_values, reference_path, generated_path, num_inference_steps, prompt)
Write SSIM results to a JSON file in the same directory as the generated videos.