/ Модель

Характеристики

Лицензия
Apache 2.0
Архитектура
text-to-video · dense
Базовая модель
CogVideoX-2b
Библиотека
onnxruntime
Опубликована
22 ноя 2026

video-ai-cogvideox-2b-onnx

Генерация видеоТекст → видео3 профессии
29скачиваний за 30 дней0лайковвеса обновлены22 ноя 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Экспериментальная квантованная ONNX-версия CogVideoX-2B для локальной генерации видео по текстовым промптам, включая запуск на CPU.

Это экспериментальная ONNX-версия CogVideoX-2B, подготовленная автором репозитория ankit arora для локальной генерации видео по текстовому описанию. Пакет разделён на три компонента: текстовый энкодер T5, видеотрансформер CogVideoX и декодер VAE. Для выполнения используется ONNX Runtime; компоненты квантованы: энкодер и трансформер — до INT4, декодер — до INT8. Исходная модель — THUDM/CogVideoX-2b; в метаданных также указана связь с zai-org/CogVideoX-2b.

Модель предназначена для экспериментов с генерацией видео на CPU, локального запуска, изучения квантования и разработки или оценки ONNX-пайплайнов. В README описана проверка на Apple Silicon с 16 ГБ памяти и настройки генерации, включая число шагов, seed, разрешение и частоту кадров. Основной язык промптов — английский; пользователь подаёт текст и получает видео.

Качество генерации и полная сквозная работа пакета не валидированы достаточно полно. CPU-инференс существенно медленнее оптимизированного GPU, квантование может накапливать ошибки при итеративной генерации, а качество декодирования INT8 требует отдельной визуальной проверки. Поддержка динамических форм не гарантирует работу при любых разрешениях; результат и производительность зависят от оборудования и версии ONNX Runtime. Репозиторий обозначен как экспериментальная конверсия, не поддерживаемая официально авторами CogVideoX. Лицензия — Apache-2.0.

Сценарии применения

  • генерация коротких видео по английскому текстовому описанию
  • эксперименты с генерацией видео на CPU и Apple Silicon
  • оценка влияния INT4-квантования на видеотрансформер
  • бенчмаркинг инференса CogVideoX через ONNX Runtime
  • разработка локального пайплайна генерации видео

Ограничения

Сквозное качество генерации полностью не проверено; INT4 и INT8 могут ухудшать точность и визуальное качество, а инференс на CPU значительно медленнее оптимизированного GPU. Динамические формы не гарантируют поддержку произвольных разрешений, а результат зависит от оборудования и версии ONNX Runtime.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

CogVideoX-2B ONNX INT4/INT8 CPU

A quantized, CPU-oriented ONNX implementation of CogVideoX-2B for local text-to-video generation.

This project converts the CogVideoX-2B text-to-video pipeline into modular ONNX models, applying INT4 and INT8 quantization to reduce model storage requirements and make CPU-based inference experiments more accessible.

The implementation targets local inference environments, including Apple Silicon systems, without requiring a dedicated NVIDIA GPU.

Highlights

  • CogVideoX-2B text-to-video architecture.
  • ONNX Runtime inference.
  • INT4 RTN transformer quantization.
  • INT4 T5 text encoder quantization.
  • INT8 VAE decoder quantization.
  • INT4 block size 32.
  • RTN accuracy level 4.
  • CPUExecutionProvider support.
  • Modular model components.
  • External ONNX tensor data support.
  • Configurable inference steps, seed, resolution and FPS.
  • DDIM scheduler configuration.
  • Classifier-free guidance support in the generation implementation.
  • FP32 versus INT4 numerical validation.
  • Designed for local and resource-constrained inference experiments.

Model Information

PropertyValue
ModelCogVideoX-2B
Model typeText-to-video
ArchitectureDiffusion Transformer
Base modelTHUDM/CogVideoX-2b
Text encoderT5
TransformerCogVideoXTransformer3DModel
VAEAutoencoderKLCogVideoX
Model formatONNX
Inference engineONNX Runtime
Execution providerCPUExecutionProvider
Transformer precisionINT4
Text encoder precisionINT4
VAE precisionINT8
Quantization methodRTN
Transformer block size32
Quantization accuracy level4
SchedulerCogVideoXDDIMScheduler
Video frames49-frame configuration
Default frame rate8 FPS

Model Architecture

The pipeline consists of three independently executable ONNX components.

1. Text encoder

The T5 text encoder converts the input prompt into text embeddings used to condition the video-generation transformer.

PropertyConfiguration
ModelT5EncoderModel
TokenizerT5Tokenizer
PrecisionINT4
Sequence length226
Embedding dimension4096
InputToken IDs and attention mask
OutputText embeddings

2. Video transformer

The transformer is responsible for iterative video latent denoising.

PropertyConfiguration
ArchitectureCogVideoXTransformer3DModel
PrecisionINT4
QuantizationRTN
Block size32
Accuracy level4
Latent channels16
InputVideo latents, text embeddings and timestep
OutputPredicted noise / velocity

3. VAE decoder

The VAE converts the final denoised latent representation into video frames.

PropertyConfiguration
ArchitectureAutoencoderKLCogVideoX
PrecisionINT8
Input channels16
Output channels3
Temporal compression4
Spatial compression8
Latent scaling factor1.15258426

The transformer uses video latents in [batch, frames, channels, height, width] order. The VAE decoder uses [batch, channels, frames, height, width] order.

Quantization Configuration

Transformer INT4

The transformer uses RTN quantization with:

  • Weight precision: INT4.
  • Block size: 32.
  • Accuracy level: 4.
  • ONNX Runtime MatMulNBits operators.
  • External tensor data for large model weights.

The objective is to reduce transformer storage requirements while retaining numerical similarity to the original FP32 graph.

Text encoder INT4

The T5 encoder is quantized independently to reduce the storage footprint of the prompt-conditioning component.

VAE INT8

The VAE decoder uses INT8 quantization to reduce its model storage requirements.

VAE quality should be evaluated independently because small numerical differences in decoded pixels can affect visual quality.

Repository Structure

video-ai-cogvideox-2b-onnx /
│
├── text_encoder/
│   ├── model_int4.onnx
│   └── model_int4.onnx.data
│
├── transformer/
│   ├── model_dynamic_int4.onnx
│   └── model_dynamic_int4.onnx.data
│
├── vae_decoder/
│   ├── model_int8.onnx
│   └── model_int8.onnx.data
│
├── tokenizer/
│
├── scheduler/
│   └── scheduler_config.json
│
├── model_index.json
├── config.json
├── manifest.json
└── README.md

External ONNX tensor data files must be distributed alongside their corresponding ONNX graph files.

Inference Pipeline

The generation process follows this sequence:

  1. Tokenize the input prompt.
  2. Generate text embeddings using the T5 ONNX encoder.
  3. Initialize random video latents.
  4. Create the scheduler timesteps.
  5. Execute iterative transformer denoising.
  6. Apply classifier-free guidance when enabled.
  7. Pass final latents into the VAE decoder.
  8. Convert decoded frames into RGB video.
  9. Encode the output using FFmpeg.

Scheduler

The pipeline uses the CogVideoX DDIM scheduler configuration.

ParameterValue
SchedulerCogVideoXDDIMScheduler
Beta schedulescaled_linear
Beta start0.00085
Beta end0.012
Training timesteps1000
Prediction typev_prediction
Zero terminal SNREnabled
SNR shift scale3.0
Timestep spacingtrailing
Clip sampleDisabled
Sampling eta0

The scheduler implementation should be validated against the corresponding Diffusers reference version before claiming exact numerical parity.

Hardware and Software Environment

Tested environment

ComponentConfiguration
DeviceApple Silicon MacBook Air
System memory16 GB
ExecutionCPU
Python3.12.15
ONNX Runtime1.32.0
ONNX1.23.2
PyTorch2.15.0
Transformers5.23.0
CPU providerCPUExecutionProvider

These are the recorded development environment versions. Compatibility with other systems and runtime versions should be tested separately.

Performance Benchmarks

This section distinguishes measured results from future optimization targets.

1. Initial end-to-end inference benchmark

Recorded using the initial 128 × 128 generation configuration.

BenchmarkResult
Resolution128 × 128
Frames49
FPS8
Duration6.125 seconds
Denoising steps10
Guidance scale1.0
Seed42
Peak process RSSApproximately 3.78 GB
Output sizeApproximately 0.12 MB
Total generation timeApproximately 154.59 seconds

2. Pipeline stage timings

Pipeline stageTime
Text encoder loading12.42 s
Text encoding4.28 s
Transformer loading7.62 s
Transformer denoisingApproximately 85.5 s
VAE loading2.89 s
VAE decoding35.16 s
TotalApproximately 154.59 s

The measured transformer denoising time corresponds to approximately 8.55 seconds per step for the recorded 10-step run.

The timing figures are rounded and should be treated as an initial baseline rather than a statistically controlled benchmark.

3. Transformer FP32 versus INT4 accuracy

The transformer was evaluated using identical deterministic random inputs.

MetricResult
Mean absolute error0.04265974
Root mean squared error0.05332734
Maximum absolute error0.19219160
Cosine similarity0.99761802

FP32 output statistics

MetricValue
Mean-0.04781635
Standard deviation0.7217795
Minimum-1.3008336
Maximum1.323802

INT4 output statistics

MetricValue
Mean-0.0462040
Standard deviation0.7390063
Minimum-1.3934109
Maximum1.425022

Interpretation: The high cosine similarity indicates strong directional agreement between the FP32 and INT4 outputs for this test input. It does not prove equivalent generated video quality or guarantee similar behavior over the full denoising trajectory.

4. VAE numerical validation

An earlier FP32 ONNX versus PyTorch comparison produced:

MetricResult
Output shape1 × 3 × 49 × 32 × 32
MAE0.00000016677
RMSE0.00000024185
Maximum absolute error0.0000023246

This comparison validates the FP32 ONNX decoder against its PyTorch reference for the tested input. It is not an INT8-versus-FP32 quality result.

5. VAE INT8 calibration measurements

Previously recorded synthetic-input calibration results:

Latent input sizeMAERMSEMaximum error
4 × 40.005640.010650.2714
8 × 80.004980.006500.1624
16 × 160.006270.031797.825

The larger maximum error at 16 × 16 suggests that calibration outliers require investigation. These measurements should not be interpreted as a final perceptual-quality evaluation.

6. Model storage

ComponentRecorded information
Complete ONNX packageApproximately 4.97 GB
Transformer external dataApproximately 2.113 GB
Transformer graphINT4
Text encoderINT4
VAE decoderINT8

The complete package includes model graphs, weights, tokenizer, scheduler and configuration files.

Performance Analysis

Current bottlenecks

The initial benchmark indicates that the major runtime costs are:

  1. Transformer denoising.
  2. VAE decoding.
  3. Model loading and initialization.
  4. Text encoding.

The transformer is the primary target for inference optimization, while VAE decoding is a substantial secondary target.

Optimization priority 1: Transformer inference

The transformer contains a large number of quantized matrix multiplication operators.

Optimization work should focus on:

  • Profiling MatMulNBits execution.
  • Identifying expensive operator groups.
  • Measuring quantized kernel throughput.
  • Comparing intra-op thread configurations.
  • Testing sequential versus parallel operator execution.
  • Evaluating ONNX Runtime graph optimization levels.
  • Measuring memory bandwidth utilization.
  • Reducing temporary tensor allocations.
  • Reusing input/output buffers where supported.

A key objective is to distinguish whether inference is CPU-compute-bound, memory-bandwidth-bound, or limited by quantized operator implementation.

Optimization priority 2: CPU thread tuning

Benchmark multiple thread configurations rather than assuming more threads are always faster.

Suggested configurations:

Intra-op threadsTest objective
1Single-thread baseline
2Low-concurrency inference
4Existing benchmark configuration
6Increased parallelism
8Higher concurrency
10Oversubscription investigation

Record total generation time, transformer time per step, CPU utilization and peak memory for each configuration.

Optimization priority 3: ONNX Runtime session configuration

Evaluate:

  • ORT_ENABLE_BASIC.
  • ORT_ENABLE_EXTENDED.
  • ORT_ENABLE_ALL.
  • Intra-op execution mode.
  • Inter-op execution mode.
  • Execution spinning.
  • Thread affinity.
  • Memory arena configuration.
  • Sequential versus parallel graph execution.

The best configuration must be established experimentally. Operator fusion or graph optimization may not improve every quantized graph.

Optimization priority 4: Classifier-free guidance

Classifier-free guidance requires conditional and unconditional transformer predictions.

For memory-constrained systems, sequential execution can avoid creating a larger combined transformer batch.

Benchmark:

  • Guidance disabled.
  • Guidance enabled.
  • Sequential conditional/unconditional execution.
  • Batched conditional/unconditional execution where memory permits.

Measure both execution time and output quality. Guidance is a quality-versus-compute decision, not a free optimization.

Optimization priority 5: VAE decoding

Investigate:

  • Intermediate tensor allocation.
  • Temporal decoding memory usage.
  • Spatial tiling where supported.
  • Frame processing strategies where compatible with the VAE architecture.
  • INT8 calibration improvements.
  • FP32 versus INT8 perceptual quality.
  • Buffer reuse.

Any tiled or frame-wise decoding approach must preserve temporal consistency and validate against the original VAE output.

Optimization priority 6: Memory and data movement

Investigate:

  • Avoiding unnecessary tensor copies.
  • Reducing PyTorch/NumPy conversion overhead.
  • Reusing preallocated buffers.
  • Avoiding duplicated model sessions.
  • Releasing unused intermediate tensors.
  • Measuring resident memory and peak memory separately.
  • Measuring model load time independently from inference time.

Optimization priority 7: Video encoding

Investigate:

  • FFmpeg streaming input.
  • Encoding preset selection.
  • CRF configuration.
  • H.264 bitrate and output size.
  • Hardware-accelerated encoding where supported.

Video encoding should be benchmarked separately from neural inference so that encoding performance does not distort model measurements.

Benchmarking Protocol

A reliable performance report should use the following protocol:

  1. Record hardware and operating system details.
  2. Record runtime and library versions.
  3. Load model sessions.
  4. Execute warm-up iterations.
  5. Measure repeated inference runs.
  6. Separate model loading from inference.
  7. Measure every pipeline stage.
  8. Record per-step transformer latency.
  9. Record peak process RSS.
  10. Record CPU utilization.
  11. Record output video dimensions and size.
  12. Validate output frame count and decode integrity.
  13. Repeat with fixed prompts and seeds.
  14. Compare numerical output against the reference implementation.

Report median, mean, minimum, maximum and standard deviation rather than relying on one execution.

Recommended Benchmark Matrix

The following is the proposed benchmark suite. These are test configurations, not completed measurements.

Resolution benchmark

ResolutionPurpose
128 × 128Existing smoke-test baseline
160 × 240Low-resolution quality test
240 × 320Intermediate workload
320 × 480Higher-resolution workload
480 × 720Original model resolution reference

The original CogVideoX-2B model is associated with a 480 × 720 video configuration. Arbitrary dynamic ONNX dimensions do not guarantee that every resolution will produce equivalent quality.

Denoising-step benchmark

StepsObjective
5Aggressive speed experiment
10Existing baseline
15Intermediate quality/speed test
20Higher-quality experiment
30Extended denoising experiment
50Reference-style inference configuration

Reduced-step generation must be evaluated for visual quality, not just runtime.

Frame-count benchmark

FramesObjective
13Short clip
25Intermediate clip
49Existing configuration
65Extended temporal workload

Validate temporal dimensions and model constraints before treating these as supported configurations.

Quantization benchmark

Compare:

  • FP32 reference.
  • INT8 transformer.
  • INT4 transformer, block size 32.
  • Alternative INT4 block sizes where supported.
  • INT4 T5 encoder versus reference.
  • INT8 VAE versus FP32 reference.

Measure:

  • MAE.
  • RMSE.
  • Maximum absolute error.
  • Cosine similarity.
  • Model file size.
  • Peak memory.
  • Inference latency.
  • Video perceptual quality.
  • Temporal consistency.

Performance Metrics

The following metrics should be reported for every benchmark.

MetricDescription
Model load timeTime to initialize ONNX sessions
Prompt encoding timeT5 inference latency
Transformer step latencyAverage denoising step time
Transformer total timeTotal denoising duration
VAE decode timeVideo latent decoding latency
Total generation timeComplete end-to-end latency
Peak RSSMaximum resident memory
CPU utilizationCPU workload during inference
Model storageDisk footprint
Output sizeEncoded MP4 size
Frames per secondGenerated frames divided by total generation time
Real-time factorGeneration time divided by video duration
Quantization errorDifference against reference output

Derived performance formulas

Generation throughput

Frames per second:

generated_frames / total_generation_seconds

Real-time factor

generation_seconds / output_video_duration_seconds

Speedup

FP32_generation_time / quantized_generation_time

Storage reduction

(FP32_size - quantized_size) / FP32_size * 100

Memory reduction

(FP32_peak_memory - quantized_peak_memory) / FP32_peak_memory * 100

These metrics should only be calculated from equivalent workloads and hardware.

Benchmark Results Status

EvaluationStatus
ONNX model loadingTested
CPUExecutionProviderTested
Transformer INT4 numerical comparisonTested
FP32 VAE ONNX parityTested
Initial end-to-end generationTested
INT8 VAE calibrationInitial testing
End-to-end visual qualityRequires further validation
Full FP32 versus INT4 video comparisonPending
Thread-count comparisonPending
ORT graph optimization comparisonPending
Resolution scaling benchmarkPending
50-step reference configurationPending
Per-operator profilingPending
Repeated statistical benchmarksPending

Reproducibility

For reproducible results, preserve:

  • Model manifest.
  • ONNX model files.
  • External tensor data.
  • Tokenizer files.
  • Scheduler configuration.
  • Runtime versions.
  • Quantization configuration.
  • Prompt.
  • Negative prompt.
  • Random seed.
  • Resolution.
  • Frame count.
  • FPS.
  • Inference steps.
  • Guidance scale.
  • CPU thread configuration.

The same random seed alone does not guarantee identical output across different runtimes, quantization implementations, hardware architectures or numerical precision settings.

Intended Use

This model package is intended for:

  • Local text-to-video experimentation.
  • CPU-based ONNX inference.
  • Quantized model research.
  • ONNX Runtime performance evaluation.
  • Model compression experimentation.
  • Video-generation pipeline development.
  • Inference benchmarking and optimization.

Limitations

  • CPU inference is substantially more computationally demanding than optimized GPU inference.
  • INT4 quantization may introduce cumulative errors during iterative denoising.
  • INT8 VAE quantization requires perceptual validation.
  • Dynamic ONNX shapes do not guarantee unrestricted resolution support.
  • High-resolution generation may require substantial memory.
  • The current end-to-end output quality has not been fully validated.
  • Reduced inference steps can degrade temporal coherence and prompt adherence.
  • Performance varies by CPU architecture, memory bandwidth and ONNX Runtime version.
  • This package is an experimental conversion and optimization, not an officially maintained upstream CogVideoX release.

Future Development

Inference engine

  • Operator-level profiling.
  • Optimized MatMulNBits execution.
  • Runtime thread tuning.
  • Memory allocation optimization.
  • Session reuse and warm-up.
  • Improved tensor buffer management.

Quantization

  • Improved INT4 calibration.
  • Alternative quantization block sizes.
  • INT8 transformer comparison.
  • Per-layer quantization analysis.
  • End-to-end quality evaluation.

Video generation

  • Image-to-video pipeline experiments.
  • Prompt conditioning improvements.
  • Negative prompt support.
  • Longer video experiments.
  • Temporal quality evaluation.
  • Video upscaling integration.

Deployment

  • FastAPI inference service.
  • WebSocket generation progress.
  • Asynchronous job execution.
  • Model lifecycle management.
  • Downloadable video artifacts.
  • Resource monitoring.

License

The upstream CogVideoX-2B model is distributed under the Apache 2.0 License.

This repository contains converted and quantized model artifacts derived from the upstream model. Preserve upstream copyright and license notices, include the applicable license, and document any third-party software and conversion tooling.

Citation

@article{yang2024cogvideox,
  title={CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer},
  author={Yang, Zhuoyi and Teng, Jiayan and Zheng, Wendi and Ding, Ming and Huang, Shiyu and Xu, Jiazheng and Yang, Yuanming and Hong, Wenyi and Feng, Guanyu and others},
  journal={arXiv preprint arXiv:2408.06072},
  year={2024}
}

Acknowledgements

  • CogVideoX research and model team.
  • Hugging Face Diffusers.
  • ONNX Runtime.
  • ONNX community.
  • Transformers library.

Project Status

Experimental CPU-oriented ONNX conversion.

The model has undergone initial quantization validation and CPU inference testing. Further end-to-end quality evaluation, repeated performance measurements and runtime optimization are ongoing.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · onnxruntime

Нельзя запустить

Модель выложена только в формате ONNX, рантайм загружает PyTorch-веса.

Ревизия весов
d15bb5f

0 моделей