Implementation:Zai org CogVideo SAT Inference Get Args
| Attribute | Value |
|---|---|
| Implementation Name | SAT Inference Get Args |
| Workflow | SAT Video Generation |
| Step | 1 of 5 |
| Type | API Doc |
| Source File | sat/sample_video.py:L285-301, sat/arguments.py:L58-185
|
| Repository | zai-org/CogVideo |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Implementation of the argument parsing system for SAT-based CogVideoX inference. The get_args function extends SAT's base argument parser with inference-specific parameters for controlling video generation resolution, frame count, FPS, prompt input method, and image-to-video mode.
Description
The get_args function builds an argument parser that combines:
- SAT framework's base arguments (model architecture, distributed settings, checkpoint path)
- YAML configuration loading via
--base - Inference-specific arguments added by the sample_video module
The function returns a fully populated argparse.Namespace object that is passed to all subsequent pipeline stages including model loading, prompt reading, and sampling.
Usage
from arguments import get_args
# Parse from sys.argv
args = get_args()
# Or parse from explicit list
args = get_args(["--base", "configs/cogvideox_2b.yaml",
"--sampling-image-size", "768", "1360",
"--sampling-num-frames", "32"])
Code Reference
Source Location
| File | Lines | Description |
|---|---|---|
sat/sample_video.py |
L285-301 | Inference argument additions |
sat/arguments.py |
L58-185 | Base SAT argument parser |
Signature
def get_args(args_list=None) -> argparse.Namespace:
# Key inference-specific params:
# --base: YAML config files
# --input-type: "cli" or "txt"
# --input-file: prompt file path
# --sampling-image-size: [768, 1360]
# --sampling-num-frames: 32
# --sampling-fps: 8
# --image2video: bool flag
Import
from arguments import get_args
I/O Contract
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
args_list |
Optional[List[str]] |
None (uses sys.argv) |
Explicit argument list for testing |
--base |
List[str] |
Required | YAML config file paths |
--input-type |
str |
"cli" |
Prompt input method: "cli" or "txt"
|
--input-file |
str |
None |
Path to prompt text file (required if input-type is "txt")
|
--sampling-image-size |
List[int] |
[768, 1360] |
Output video resolution [height, width] |
--sampling-num-frames |
int |
32 |
Number of frames to generate |
--sampling-fps |
int |
8 |
Frames per second of output video |
--image2video |
bool |
False |
Enable image-to-video generation mode |
Outputs
| Output | Type | Description |
|---|---|---|
| Return value | argparse.Namespace |
Fully populated argument namespace combining YAML config and CLI overrides |
Usage Examples
Example 1: Text-to-video generation
python sat/sample_video.py \
--base configs/cogvideox_2b.yaml \
--sampling-image-size 768 1360 \
--sampling-num-frames 32 \
--sampling-fps 8 \
--input-type cli
Example 2: Batch generation from file
python sat/sample_video.py \
--base configs/cogvideox_5b.yaml \
--sampling-image-size 480 720 \
--sampling-num-frames 48 \
--input-type txt \
--input-file prompts.txt
Example 3: Image-to-video generation
python sat/sample_video.py \
--base configs/cogvideox_5b_i2v.yaml \
--sampling-image-size 480 720 \
--sampling-num-frames 48 \
--input-type cli \
--image2video
Related Pages
- Principle:Zai_org_CogVideo_SAT_Inference_Configuration -- Principle governing inference configuration
- Environment:Zai_org_CogVideo_SAT_Framework_Environment
- Zai_org_CogVideo_SAT_Get_Model_Load_Checkpoint -- Next step: model loading using the parsed args
- Zai_org_CogVideo_SAT_Read_From_CLI_File -- Prompt reading controlled by
--input-type