[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-wilson1yan--VideoGPT":3,"tool-wilson1yan--VideoGPT":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":68,"owner_location":79,"owner_email":80,"owner_twitter":75,"owner_website":81,"owner_url":82,"languages":83,"stars":96,"forks":97,"last_commit_at":98,"license":99,"difficulty_score":10,"env_os":100,"env_gpu":101,"env_ram":102,"env_deps":103,"category_tags":113,"github_topics":68,"view_count":114,"oss_zip_url":68,"oss_zip_packed_at":68,"status":16,"created_at":115,"updated_at":116,"faqs":117,"releases":147},158,"wilson1yan\u002FVideoGPT","VideoGPT",null,"VideoGPT 是一个用于生成视频的开源 AI 工具，它结合了 VQ-VAE 和 Transformer 技术，能从学习到的离散视频编码中自回归地合成新视频。它解决了传统视频生成模型结构复杂、训练困难的问题，用简洁统一的架构实现了高质量视频生成，在 BAIR 机器人数据集上效果媲美顶尖 GAN 模型，也能在 UCF-101 和 TGIF 等自然视频数据集上生成逼真结果。\n\nVideoGPT 特别适合 AI 研究人员和深度学习开发者使用，尤其对想快速复现或实验 Transformer 视频生成方案的人非常友好。它支持标准视频文件夹结构或 HDF5 格式输入，提供 Colab 示例和 Hugging Face 在线演示，降低了上手门槛。技术亮点在于使用 3D 卷积与轴向自注意力压缩视频为离散编码，再用类 GPT 的 Transformer 进行时空建模，结构清晰、训练稳定。还支持稀疏注意力机制，帮助资源有限的用户节省显存。无论是学术研究还是工程探索，VideoGPT 都是一个轻量、可复现、易扩展的视频生成起点。","# VideoGPT: Video Generation using VQ-VAE and Transformers\n\n[[Paper]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.10157)[[Website]](https:\u002F\u002Fwilson1yan.github.io\u002Fvideogpt\u002Findex.html)[[Colab]](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fwilson1yan\u002FVideoGPT\u002Fblob\u002Fmaster\u002Fnotebooks\u002FUsing_VideoGPT.ipynb)\nIntegrated to [Huggingface Spaces](https:\u002F\u002Fhuggingface.co\u002Fspaces) with [Gradio](https:\u002F\u002Fgithub.com\u002Fgradio-app\u002Fgradio). See demo: [![Hugging Face Spaces](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fakhaliq\u002FVideoGPT)\n\nWe present VideoGPT: a conceptually simple architecture for scaling likelihood based generative modeling to natural videos. VideoGPT uses VQ-VAE that learns downsampled discrete latent representations of a raw video by employing 3D convolutions and axial self-attention. A simple GPT-like architecture is then used to autoregressively model the discrete latents using spatio-temporal position encodings. Despite the simplicity in formulation and ease of training, our architecture is able to generate samples competitive with state-of-the-art GAN models for video generation on the BAIR Robot dataset, and generate high fidelity natural images from UCF-101 and Tumbler GIF Dataset (TGIF). We hope our proposed architecture serves as a reproducible reference for a minimalistic implementation of transformer based video generation models.\n\n\n## Approach\n![VideoGPT](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fwilson1yan_VideoGPT_readme_80a92a19c51d.png)\n\n## Installation\nChange the `cudatoolkit` version compatible to your machine.\n```bash\nconda install --yes -c conda-forge cudatoolkit=11.0 cudnn\npip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Ftorch_stable.html\npip install git+https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT.git\n```\n\n### Sparse Attention (Optional)\nFor limited compute scenarios, it may be beneficial to use [sparse attention](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.10509).\n```bash\nsudo apt-get install llvm-9-dev\nDS_BUILD_SPARSE_ATTN=1 pip install deepspeed\n```\nAfter installng `deepspeed`, you can train a sparse transformer by setting the flag `--attn_type sparse` in `scripts\u002Ftrain_videogpt.py`. The default supported sparsity configuration is an N-d strided sparsity layout, however, you can write your own arbitrary layouts to use.\n\n## Dataset\nThe default code accepts data as an HDF5 file with the specified format in `videogpt\u002Fdata.py`. An example of such a dataset can be constructed from the BAIR Robot data by running the script:\n```bash\nsh scripts\u002Fpreprocess\u002Fbair\u002Fcreate_bair_dataset.sh datasets\u002Fbair\n``` \nAlternatively, the code supports a dataset with the following directory structure:\n```\nvideo_dataset\u002F\n    train\u002F\n        class_0\u002F\n            video1.mp4\n            video2.mp4\n            ...\n        class_1\u002F\n            video1.mp4\n            ...\n        ...\n        class_n\u002F\n            ...\n    test\u002F\n        class_0\u002F\n            video1.mp4\n            video2.mp4\n            ...\n        class_1\u002F\n            video1.mp4\n            ...\n        ...\n        class_n\u002F\n            ...\n```\nAn example of such a dataset can be constructed from [UCF-101](https:\u002F\u002Fwww.crcv.ucf.edu\u002Fdata\u002FUCF101.php) data by running the script \n```bash\nsh scripts\u002Fpreprocess\u002Fucf101\u002Fcreate_ucf_dataset.sh datasets\u002Fucf101\n``` \nYou may need to install `unrar` and `unzip` for the code to work correctly.\n\nIf you do not care about classes, the class folders are not necessary and the dataset file structure can be collapsed into `train` and `test` directories of just videos.\n\n```python\nfrom torchvision.io import read_video\nfrom videogpt import load_vqvae\nfrom videogpt.data import preprocess\n\nvideo_filename = 'path\u002Fto\u002Fvideo_file.mp4'\nsequence_length = 16\nresolution = 128\ndevice = torch.device('cuda')\n\nvqvae = load_vqvae('kinetics_stride2x4x4')\nvideo = read_video(video_filename, pts_unit='sec')[0]\nvideo = preprocess(video, resolution, sequence_length).unsqueeze(0).to(device)\n\nencodings = vqvae.encode(video)\nvideo_recon = vqvae.decode(encodings)\n```\n\n## Training VQ-VAE\nUse the `scripts\u002Ftrain_vqvae.py` script to train a VQ-VAE. Execute `python scripts\u002Ftrain_vqvae.py -h` for information on all available training settings. A subset of more relevant settings are listed below, along with default values.\n### VQ-VAE Specific Settings\n* `--embedding_dim`: number of dimensions for codebooks embeddings\n* `--n_codes 2048`: number of codes in the codebook\n* `--n_hiddens 240`: number of hidden features in the residual blocks\n* `--n_res_layers 4`: number of residual blocks\n* `--downsample 4 4 4`: T H W downsampling stride of the encoder\n\n### Training Settings\n* `--gpus 2`: number of gpus for distributed training\n* `--sync_batchnorm`: uses `SyncBatchNorm` instead of `BatchNorm3d` when using > 1 gpu\n* `--gradient_clip_val 1`: gradient clipping threshold for training\n* `--batch_size 16`: batch size per gpu\n* `--num_workers 8`: number of workers for each DataLoader\n\n### Dataset Settings\n* `--data_path \u003Cpath>`: path to an `hdf5` file or a folder containing `train` and `test` folders with subdirectories of videos\n* `--resolution 128`: spatial resolution to train on \n* `--sequence_length 16`: temporal resolution, or video clip length\n\n## Training VideoGPT\nUse the `scripts\u002Ftrain_videogpt.py` script to train an VideoGPT model for sampling. Execute `python scripts\u002Ftrain_videogpt.py -h` for information on all available training settings. A subset of more relevant settings are listed below, along with default values.\n### VideoGPT Specific Settings\n* `--vqvae kinetics_stride4x4x4`: path to a vqvae checkpoint file\n* `--n_cond_frames 0`: number of frames to condition on. `0` represents a non-frame conditioned model\n* `--class_cond`: trains a class conditional model if activated\n* `--hidden_dim 576`: number of transformer hidden features\n* `--heads 4`: number of heads for multihead attention\n* `--layers 8`: number of transformer layers\n* `--dropout 0.2'`: dropout probability applied to features after attention and positionwise feedforward layers\n* `--attn_type full`: `full` or `sparse` attention. Refer to the Installation section for install sparse attention\n* `--attn_dropout 0.3`: dropout probability applied to the attention weight matrix\n### Training Settings\n* `--gpus 4`: number of gpus for distributed training\n* `--gradient_clip_val 1`: gradient clipping threshold for training\n* `--batch_size 8`: batch size per gpu\n* `--num_workers 2`: number of workers for each DataLoader\n* `--amp_level O1`: for mixed precision training\n* `--precision 16`: for mixed precision training\n\n### Dataset Settings\n* `--data_path \u003Cpath>`: path to an `hdf5` file or a folder containing `train` and `test` folders with subdirectories of videos\n* `--resolution 128`: spatial resolution to train on \n* `--sequence_length 16`: temporal resolution, or video clip length\n\n## Sampling VideoGPT\nVideoGPT models can be sampled using the `scripts\u002Fsample_videogpt.py`. You can specify a path to a checkpoint during training. You may need to install `ffmpeg`: `sudo apt-get install ffmpeg`\n\n## Evaluation\nEvaluation is done primarily using [Frechet Video Distance (FVD)](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.01717) for BAIR and Kinetics, and [Inception Score](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.03498) for UCF-101. Inception Score can be computed by generating samples and using the code from the [TGANv2 repo](https:\u002F\u002Fgithub.com\u002Fpfnet-research\u002Ftgan2). FVD can be computed through `python scripts\u002Fcompute_fvd.py`, which runs a PyTorch-ported version of the [original codebase](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fgoogle-research\u002Ftree\u002Fmaster\u002Ffrechet_video_distance)\n\n## Reproducing Paper Results\nNote that this repo is primarily designed for simplicity and extending off of our method. Reproducing the full paper results can be done using code found at a [separate repo](https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT-Paper). However, be aware that the code is not as clean.\n\n## Citation\nPlease consider using the follow citation when using our code:\n```\n@misc{yan2021videogpt,\n      title={VideoGPT: Video Generation using VQ-VAE and Transformers}, \n      author={Wilson Yan and Yunzhi Zhang and Pieter Abbeel and Aravind Srinivas},\n      year={2021},\n      eprint={2104.10157},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV}\n}\n```\n","# VideoGPT：使用 VQ-VAE 和 Transformers 进行视频生成\n\n[[论文]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.10157)[[项目网站]](https:\u002F\u002Fwilson1yan.github.io\u002Fvideogpt\u002Findex.html)[[Colab 教程]](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fwilson1yan\u002FVideoGPT\u002Fblob\u002Fmaster\u002Fnotebooks\u002FUsing_VideoGPT.ipynb)  \n已集成至 [Huggingface Spaces](https:\u002F\u002Fhuggingface.co\u002Fspaces)，使用 [Gradio](https:\u002F\u002Fgithub.com\u002Fgradio-app\u002Fgradio)。查看演示：[![Hugging Face Spaces](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fakhaliq\u002FVideoGPT)\n\n我们提出 VideoGPT：一种概念上简洁的架构，用于将基于似然（likelihood-based）的生成建模扩展到自然视频领域。VideoGPT 使用 VQ-VAE（Vector Quantized Variational AutoEncoder，向量量化变分自编码器），通过 3D 卷积和轴向自注意力机制学习原始视频的下采样离散潜在表示。随后，采用类似 GPT 的简单架构，利用时空位置编码对离散潜在变量进行自回归建模。尽管公式简洁且训练容易，我们的架构在 BAIR Robot 数据集上的视频生成效果可与当前最先进的 GAN 模型相媲美，并能从 UCF-101 和 Tumblr GIF 数据集（TGIF）中生成高保真自然图像。我们希望所提出的架构能作为基于 Transformer 的视频生成模型的最小化、可复现实现参考。\n\n## 方法\n![VideoGPT](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fwilson1yan_VideoGPT_readme_80a92a19c51d.png)\n\n## 安装\n请根据你的机器调整 `cudatoolkit` 版本。\n```bash\nconda install --yes -c conda-forge cudatoolkit=11.0 cudnn\npip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Ftorch_stable.html\npip install git+https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT.git\n```\n\n### 稀疏注意力（Sparse Attention，可选）\n在计算资源受限的情况下，使用[稀疏注意力](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.10509)可能更有利。\n```bash\nsudo apt-get install llvm-9-dev\nDS_BUILD_SPARSE_ATTN=1 pip install deepspeed\n```\n安装 `deepspeed` 后，可通过在 `scripts\u002Ftrain_videogpt.py` 中设置标志 `--attn_type sparse` 来训练稀疏 Transformer。默认支持的稀疏配置是 N 维步幅稀疏布局，但你也可以编写自己的任意稀疏布局。\n\n## 数据集\n默认代码接受符合 `videogpt\u002Fdata.py` 中指定格式的 HDF5 文件。例如，可以通过运行以下脚本从 BAIR Robot 数据构建此类数据集：\n```bash\nsh scripts\u002Fpreprocess\u002Fbair\u002Fcreate_bair_dataset.sh datasets\u002Fbair\n``` \n或者，代码也支持如下目录结构的数据集：\n```\nvideo_dataset\u002F\n    train\u002F\n        class_0\u002F\n            video1.mp4\n            video2.mp4\n            ...\n        class_1\u002F\n            video1.mp4\n            ...\n        ...\n        class_n\u002F\n            ...\n    test\u002F\n        class_0\u002F\n            video1.mp4\n            video2.mp4\n            ...\n        class_1\u002F\n            video1.mp4\n            ...\n        ...\n        class_n\u002F\n            ...\n```\n例如，可通过运行以下脚本从 [UCF-101](https:\u002F\u002Fwww.crcv.ucf.edu\u002Fdata\u002FUCF101.php) 数据构建此类数据集：\n```bash\nsh scripts\u002Fpreprocess\u002Fucf101\u002Fcreate_ucf_dataset.sh datasets\u002Fucf101\n``` \n你可能需要安装 `unrar` 和 `unzip` 才能使代码正常工作。\n\n如果你不关心类别，可以省略类别文件夹，直接将数据集结构简化为仅包含视频文件的 `train` 和 `test` 目录。\n\n```python\nfrom torchvision.io import read_video\nfrom videogpt import load_vqvae\nfrom videogpt.data import preprocess\n\nvideo_filename = 'path\u002Fto\u002Fvideo_file.mp4'\nsequence_length = 16\nresolution = 128\ndevice = torch.device('cuda')\n\nvqvae = load_vqvae('kinetics_stride2x4x4')\nvideo = read_video(video_filename, pts_unit='sec')[0]\nvideo = preprocess(video, resolution, sequence_length).unsqueeze(0).to(device)\n\nencodings = vqvae.encode(video)\nvideo_recon = vqvae.decode(encodings)\n```\n\n## 训练 VQ-VAE\n使用 `scripts\u002Ftrain_vqvae.py` 脚本训练 VQ-VAE。执行 `python scripts\u002Ftrain_vqvae.py -h` 可查看所有可用训练设置。以下是部分更相关的设置及其默认值：\n\n### VQ-VAE 专属设置\n* `--embedding_dim`：码本嵌入的维度数\n* `--n_codes 2048`：码本中的码字数量\n* `--n_hiddens 240`：残差块中的隐藏特征数\n* `--n_res_layers 4`：残差块的数量\n* `--downsample 4 4 4`：编码器在时间 T、高度 H、宽度 W 上的下采样步长\n\n### 训练设置\n* `--gpus 2`：用于分布式训练的 GPU 数量\n* `--sync_batchnorm`：当使用 >1 个 GPU 时，使用 `SyncBatchNorm` 替代 `BatchNorm3d`\n* `--gradient_clip_val 1`：训练时的梯度裁剪阈值\n* `--batch_size 16`：每个 GPU 的批大小\n* `--num_workers 8`：每个 DataLoader 的工作进程数\n\n### 数据集设置\n* `--data_path \u003Cpath>`：指向 `hdf5` 文件或包含 `train` 和 `test` 子目录（内含视频子目录）的文件夹路径\n* `--resolution 128`：训练的空间分辨率\n* `--sequence_length 16`：时间分辨率，即视频片段长度\n\n## 训练 VideoGPT\n使用 `scripts\u002Ftrain_videogpt.py` 脚本训练 VideoGPT 模型以进行采样。执行 `python scripts\u002Ftrain_videogpt.py -h` 可查看所有可用训练设置。以下是部分更相关的设置及其默认值：\n\n### VideoGPT 专属设置\n* `--vqvae kinetics_stride4x4x4`：VQ-VAE 检查点文件路径\n* `--n_cond_frames 0`：条件帧数量。`0` 表示非帧条件模型\n* `--class_cond`：若启用，则训练类别条件模型\n* `--hidden_dim 576`：Transformer 隐藏特征数\n* `--heads 4`：多头注意力的头数\n* `--layers 8`：Transformer 层数\n* `--dropout 0.2'`：注意力层和位置前馈层后特征的 dropout 概率\n* `--attn_type full`：注意力类型，可选 `full` 或 `sparse`。安装稀疏注意力请参阅“安装”章节\n* `--attn_dropout 0.3`：注意力权重矩阵的 dropout 概率\n\n### 训练设置\n* `--gpus 4`：用于分布式训练的 GPU 数量\n* `--gradient_clip_val 1`：训练时的梯度裁剪阈值\n* `--batch_size 8`：每个 GPU 的批大小\n* `--num_workers 2`：每个 DataLoader 的工作进程数\n* `--amp_level O1`：用于混合精度训练\n* `--precision 16`：用于混合精度训练\n\n### 数据集设置\n* `--data_path \u003Cpath>`：指向 `hdf5` 文件或包含 `train` 和 `test` 子目录（内含视频子目录）的文件夹路径\n* `--resolution 128`：训练的空间分辨率\n* `--sequence_length 16`：时间分辨率，即视频片段长度\n\n## 采样 VideoGPT\nVideoGPT 模型可通过 `scripts\u002Fsample_videogpt.py` 脚本进行采样。你可以在训练过程中指定一个检查点（checkpoint）路径。你可能需要安装 `ffmpeg`：`sudo apt-get install ffmpeg`\n\n## 评估\n评估主要使用 [Frechet Video Distance (FVD，弗雷歇视频距离)](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.01717) 对 BAIR 和 Kinetics 数据集进行衡量，对 UCF-101 数据集则使用 [Inception Score（初始分数）](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.03498)。Inception Score 可通过生成样本并使用 [TGANv2 仓库](https:\u002F\u002Fgithub.com\u002Fpfnet-research\u002Ftgan2) 中的代码计算。FVD 可通过运行 `python scripts\u002Fcompute_fvd.py` 计算，该脚本使用了从[原始代码库](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fgoogle-research\u002Ftree\u002Fmaster\u002Ffrechet_video_distance)移植到 PyTorch 的版本。\n\n## 复现论文结果\n请注意，本仓库主要设计目标是简洁性及便于在此方法基础上扩展。如需完整复现论文中的结果，请使用[另一个独立仓库](https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT-Paper)中的代码。但请注意，该仓库的代码整洁度较低。\n\n## 引用\n使用我们的代码时，请考虑引用以下文献：\n```\n@misc{yan2021videogpt,\n      title={VideoGPT: Video Generation using VQ-VAE and Transformers}, \n      author={Wilson Yan and Yunzhi Zhang and Pieter Abbeel and Aravind Srinivas},\n      year={2021},\n      eprint={2104.10157},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV}\n}\n```","# VideoGPT 快速上手指南\n\n## 环境准备\n\n- **操作系统**：Linux（推荐 Ubuntu 18.04+）\n- **GPU 支持**：需 NVIDIA 显卡，支持 CUDA 11.0 或兼容版本\n- **前置依赖**：\n  - Python 3.7+\n  - Conda（推荐 Miniconda）\n  - PyTorch 1.7.1+cu110（如使用其他 CUDA 版本，请调整安装命令）\n  - 可选：`llvm-9-dev`、`ffmpeg`、`unrar`、`unzip`（用于数据预处理和稀疏注意力）\n\n> 国内用户建议配置清华或阿里云 PyPI 镜像加速 pip 安装：\n> ```bash\n> pip config set global.index-url https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n## 安装步骤\n\n```bash\n# 1. 安装 CUDA 工具包（根据你的系统 CUDA 版本调整）\nconda install --yes -c conda-forge cudatoolkit=11.0 cudnn\n\n# 2. 安装 PyTorch（CUDA 11.0 版本）\npip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Ftorch_stable.html\n\n# 3. 安装 VideoGPT\npip install git+https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT.git\n\n# （可选）安装稀疏注意力支持\nsudo apt-get install llvm-9-dev\nDS_BUILD_SPARSE_ATTN=1 pip install deepspeed\n```\n\n## 基本使用\n\n### 1. 加载预训练 VQ-VAE 并重建视频片段\n\n```python\nfrom torchvision.io import read_video\nfrom videogpt import load_vqvae\nfrom videogpt.data import preprocess\nimport torch\n\nvideo_filename = 'path\u002Fto\u002Fvideo_file.mp4'\nsequence_length = 16\nresolution = 128\ndevice = torch.device('cuda')\n\nvqvae = load_vqvae('kinetics_stride2x4x4')  # 加载预训练模型\nvideo = read_video(video_filename, pts_unit='sec')[0]\nvideo = preprocess(video, resolution, sequence_length).unsqueeze(0).to(device)\n\nencodings = vqvae.encode(video)      # 编码为离散潜变量\nvideo_recon = vqvae.decode(encodings) # 解码重建视频\n```\n\n### 2. 训练你自己的 VQ-VAE（示例命令）\n\n```bash\npython scripts\u002Ftrain_vqvae.py \\\n    --data_path datasets\u002Fbair \\\n    --resolution 128 \\\n    --sequence_length 16 \\\n    --batch_size 16 \\\n    --gpus 2\n```\n\n### 3. 训练 VideoGPT 模型（需先有 VQ-VAE 权重）\n\n```bash\npython scripts\u002Ftrain_videogpt.py \\\n    --vqvae path\u002Fto\u002Fvqvae_checkpoint.ckpt \\\n    --data_path datasets\u002Fbair \\\n    --resolution 128 \\\n    --sequence_length 16 \\\n    --batch_size 8 \\\n    --gpus 4\n```\n\n> 更多训练参数可通过 `python scripts\u002Ftrain_videogpt.py -h` 查看。","一位短视频平台的内容算法工程师，正在为提升用户生成视频的多样性与质量而发愁，需要在不增加真人拍摄成本的前提下，自动生成风格统一、动作连贯的短视频素材。\n\n### 没有 VideoGPT 时\n- 只能依赖外包团队或用户上传真实拍摄视频，制作周期长、成本高，且难以批量生成特定风格内容。\n- 使用传统GAN模型生成视频时训练不稳定，经常出现画面闪烁、动作断裂，后期还需人工筛选可用片段。\n- 视频生成模型部署复杂，需针对不同分辨率和帧率单独调参，团队缺乏统一可复用的架构标准。\n- 无法从现有视频中提取“动作模式”再生成新变体，创意复用效率极低。\n- 高清视频生成对GPU显存要求苛刻，小团队常因资源不足被迫降低画质或放弃项目。\n\n### 使用 VideoGPT 后\n- 直接输入少量示例视频（如10段舞蹈动作），VideoGPT即可自动生成数十条风格一致、动作流畅的新视频，大幅降低内容生产成本。\n- 基于VQ-VAE+Transformer架构，生成结果稳定、无闪烁，80%以上输出可直接用于A\u002FB测试，省去人工筛选环节。\n- 提供标准化HDF5或文件夹数据接口，支持UCF-101等常见数据集一键预处理，团队新人也能快速上手训练专属模型。\n- 支持从编码空间重组动作序列，例如将“挥手+转身”组合成新动作，实现创意元素的模块化复用。\n- 可选稀疏注意力机制，在消费级GPU上也能生成128x128分辨率、16帧的短视频，让小团队也能跑通全流程。\n\nVideoGPT 让视频生成从“高门槛科研实验”变成“可工程化落地的内容生产工具”，真正实现了用代码批量创造视觉内容。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fwilson1yan_VideoGPT_b484b480.png","wilson1yan","Wilson Yan","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fwilson1yan_66a1f922.jpg","Interested in generative modeling and representation learning","San Francisco, CA","wilson1.yan@berkeley.edu","https:\u002F\u002Fwilsonyan.com","https:\u002F\u002Fgithub.com\u002Fwilson1yan",[84,88,92],{"name":85,"color":86,"percentage":87},"Jupyter Notebook","#DA5B0B",70.7,{"name":89,"color":90,"percentage":91},"Python","#3572A5",28.9,{"name":93,"color":94,"percentage":95},"Shell","#89e051",0.3,1075,131,"2026-03-25T02:27:18","MIT","Linux","需要 NVIDIA GPU，CUDA 11.0，显存未说明","未说明",{"notes":104,"python":102,"dependencies":105},"需安装 llvm-9-dev 以支持稀疏注意力；数据集需为 HDF5 格式或特定目录结构；推荐使用多 GPU 分布式训练。",[106,107,108,109,110,111,112],"torch==1.7.1+cu110","torchvision==0.8.2+cu110","torchaudio==0.7.2","deepspeed","ffmpeg","unrar","unzip",[52,13],7,"2026-03-27T02:49:30.150509","2026-04-06T05:36:23.907924",[118,123,128,133,138,142],{"id":119,"question_zh":120,"answer_zh":121,"source_url":122},302,"能否将 VideoGPT 用作下一帧预测器？如何从1帧预测后续15帧？","可以。训练 VQ-VAE 时设置 `--sequence_length N + M`，训练 VideoGPT 时设置 `--sequence_length N + M --n_cond_frames N`（N为条件帧数，M为预测帧数）。例如 BAIR 模型使用序列长度16、条件帧数1、预测15帧。注意：N+M 必须是2的幂。预测时需构造包含“video”和“label”键的 batch 字典传入 sample 方法。","https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT\u002Fissues\u002F16",{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},303,"导入包时报错 'cannot import name get_num_classes from torchmetrics.utilities.data'，如何解决？","降级 torchmetrics 到 0.3.2 版本：运行 `pip install torchmetrics==0.3.2`。该问题在 Kaggle 环境中常见，切换到 Colab 并指定版本通常可解决。","https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT\u002Fissues\u002F35",{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},304,"如何生成超过16帧的长视频？是否需要重新训练模型？","直接扩展采样形状（如从 [4,32,32] 改为 [8,32,32]）会因位置编码和缓存限制失败。若想任意延长，需重新训练：先训练无时间依赖的逐帧 VQ-VAE（移除轴向注意力），再在其上训练 VideoGPT，即可逐步预测未来任意多帧的潜码。","https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT\u002Fissues\u002F22",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},305,"训练时每个视频样本包含多少帧？是从完整视频中如何截取的？","所有模型均使用16帧训练，从原始视频中随机抽取连续16帧（stride=1）。实际时长取决于原视频帧率：BAIR 数据集约40帧总长，UCF-101 为30fps、5-10分钟长视频，因此16帧可能仅代表不到1秒。","https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT\u002Fissues\u002F34",{"id":139,"question_zh":140,"answer_zh":141,"source_url":122},306,"模型的随机性来源是什么？为何相同输入能生成不同轨迹？","随机性来自自回归采样过程，具体实现在代码的 gpt.py 第111行附近。采样时每一步都基于概率分布抽样下一个token，而非确定性选择，因此即使输入相同，输出轨迹也会不同。",{"id":143,"question_zh":144,"answer_zh":145,"source_url":146},307,"为什么代码本向量先用 randn 或 zeros 初始化，再用训练批次重新初始化？","这是为了实现拉普拉斯平滑（Laplace Smoothing），避免某些码字从未被使用。初始随机值确保所有码字在训练初期都有机会被激活，随后用真实数据分布重新初始化以加速收敛并提升稳定性。","https:\u002F\u002Fgithub.com\u002Fwilson1yan\u002FVideoGPT\u002Fissues\u002F17",[]]