[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-LargeWorldModel--LWM":3,"tool-LargeWorldModel--LWM":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":79,"owner_location":79,"owner_email":79,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":91,"forks":92,"last_commit_at":93,"license":94,"difficulty_score":95,"env_os":96,"env_gpu":97,"env_ram":98,"env_deps":99,"category_tags":108,"github_topics":79,"view_count":23,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":109,"updated_at":110,"faqs":111,"releases":140},3324,"LargeWorldModel\u002FLWM","LWM","Large World Model -- Modeling Text and Video with Millions Context","LWM（Large World Model）是一款通用的多模态自回归模型，专为处理百万级超长上下文而设计。它能够同时理解文本、图像和视频，不仅能进行长文档阅读和复杂视频分析，还能基于文字生成图像与视频。\n\n传统 AI 模型往往难以处理篇幅极长的内容，且对视频中蕴含的时序信息和物理世界规律理解不足。LWM 通过整合海量长视频与书籍数据进行训练，有效解决了这一痛点。它能在超过一百万个 token 的上下文中精准检索事实，甚至能理解长达一小时的 YouTube 视频并回答相关问题，实现了从单纯的语言知识到多模态世界认知的跨越。\n\n这款工具特别适合人工智能研究人员、开发者以及需要处理大规模多模态数据的专业团队使用。其核心技术亮点在于采用了 RingAttention 技术，突破了显存限制，使得在普通硬件难以企及的超长序列上进行高效训练和推理成为可能。此外，项目还开源了参数量为 7B 的多个版本模型，支持 Jax 和 PyTorch 框架，为探索长上下文多模态应用提供了坚实的基础设施。","# Large World Model (LWM)\n\n[[Project]](https:\u002F\u002Flargeworldmodel.github.io\u002F)\n[[Paper]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.08268)\n[[Models]](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel)\n\n**Large World Model (LWM)** is a general-purpose large-context multimodal autoregressive model. It is trained on a large dataset of diverse long videos and books using RingAttention, and can perform language, image, and video understanding and generation.\n\n\n## Approach\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_2a766a6f08be.png\"\u002F>\n\u003C\u002Fdiv>\n\nCurrent language models fall short in understanding aspects of the world not easily described in words, and struggle with complex, long-form tasks. Video sequences offer valuable temporal information absent in language and static images, making them attractive for joint modeling with language. Such models could develop a understanding of both human textual knowledge and the physical world, enabling broader AI capabilities for assisting humans. However, learning from millions of tokens of video and language sequences poses challenges due to memory constraints, computational complexity, and limited datasets. To address these challenges, we curate a large dataset of diverse videos and books, utilize the RingAttention technique to scalably train on long sequences, and gradually increase context size from 4K to 1M tokens. This paper makes the following contributions: (a) Largest context size neural network: We train one of the largest context size transformers on long video and language sequences, setting new benchmarks in difficult retrieval tasks and long video understanding. (b) Solutions for overcoming vision-language training challenges, including using masked sequence packing for mixing different sequence lengths, loss weighting to balance language and vision, and model-generated QA dataset for long sequence chat. (c) A highly-optimized implementation with RingAttention, masked sequence packing, and other key features for training on millions-length multimodal sequences. (d) Fully open-sourced a family of 7B parameter models capable of processing long text documents (LWM-Text, LWM-Text-Chat) and videos (LWM, LWM-Chat) of over 1M tokens.\nThis work paves the way for training on massive datasets of long video and language to develop understanding of both human knowledge and the multimodal world, and broader capabilities.\n\n## LWM Capabilities\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_2bae2237a373.png\"\u002F>\n  \u003Cp>\n  LWM can retrieval facts across 1M context with high accuracy.\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_c62a071ed8d8.png\"\u002F>\n  \u003Cp>\n  LWM can answer questions over 1 hour YouTube video.\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_21bda4ebe3fb.png\"\u002F>\n  \u003Cp>\n  LWM can chat with images.\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_8f0cf6655c9d.png\"\u002F>\n  \u003Cp>\n  LWM can generate videos and images from text.\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\n## Setup\n\nThis codebase is supported on Ubuntu and has not been tested on Windows or macOS. We recommend using TPUs for training and inference, although it is also possible to use GPUs. On TPU, the code is highly optimized with Jax's Pallas and can achieve high MFUs with RingAttention at very large context sizes. On GPU, the code is based on XLA and is not as optimized as it is for TPU.\n\nInstall the requirements with:\n```\nconda create -n lwm python=3.10\nconda activate lwm\npip install -r gpu_requirements.txt\n```\nor set up TPU VM with:\n```\nsh tpu_requirements.sh\n```\n\n\n## Available models\n\nThere are language-only and video-language versions, offering context sizes from 32K, to 128K, 256K and 1M tokens. The vision-language models are available only in Jax, and the language-only models are available in both PyTorch and Jax. Below are the names of the available models and their corresponding context sizes and capabilities:\n\n| Model Name         | Context Size | Language or Vision-Language | Chat or Base | URL                                                                                                                                          |\n|--------------------|--------------|-----------------------------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| LWM-Text-Chat-128K | 128K         | Language                    | Chat         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-128K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-128K-Jax)] |\n| LWM-Text-Chat-256K | 256K         | Language                    | Chat         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-256K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-256K-Jax)] |\n| LWM-Text-Chat-512K | 512K         | Language                    | Chat         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-512K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-512K-Jax)] |\n| LWM-Text-Chat-1M   | 1M           | Language                    | Chat         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-1M)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-1M-Jax)]     |\n| LWM-Text-128K      | 128K         | Language                    | Base         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-128K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-128K-Jax)]           |\n| LWM-Text-256K      | 256K         | Language                    | Base         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-256K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-256K-Jax)]           |\n| LWM-Text-512K      | 512K         | Language                    | Base         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-512K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-512K-Jax)]           |\n| LWM-Text-1M        | 1M           | Language                    | Base         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-1M)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-1M-Jax)]               |\n| LWM-Chat-32K       | 32K          | Vision-Language             | Chat         | [[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-32K-Jax)]                                                                                  |\n| LWM-Chat-128K      | 128K         | Vision-Language             | Chat         | [[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-128K-Jax)]                                                                                 |\n| LWM-Chat-1M        | 1M           | Vision-Language             | Chat         | [[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-1M-Jax)]                                                                                   |\n\n\n## Code structure\nUse `scan_query_chunk_size` and `scan_key_chunk_size` to control the block size in blockwise compute of the self-attention. Use `scan_mlp_chunk_size` to control the block size in blockwise compute of the feedforward network. Use `scan_attention=True` and `scan_mlp=True` to enable\u002Fdisable blockwise compute in the self-attention and feed-forward network.\n\nYou can use `mesh_dim=dp, fsdp, tp, sp` to control the degree of parallelism and RingAttention. It is a string of 4 integers separated by commas, representing the number of data parallelism, fully sharded data parallelism, tensor parallelism, and sequence parallelism.\nFor example, `mesh_dim='1,64,4,1'` means 1 data parallelism, 64 fully sharded data parallelism, 4 tensor parallelism, and 1 sequence parallelism. `mesh_dim='1,1,4,64'` means 1 data parallelism, 1 fully sharded data parallelism, 4 tensor parallelism, and 64 sequence parallelism for RingAttention.\n\n\n## Running Jax Models\nIn this section, we provide instructions on how to run each of the provided scripts. For each script, you may need to fill in your own paths and values in the variables described in the beginning of each script.\n\nTo run each of the following scripts, use `bash \u003Cscript_name>.sh`:\n- Language model training: `bash scripts\u002Frun_train_text.sh`\n- Vision-Language model training: `bash scripts\u002Frun_train_vision_text.sh`\n- Single Needle Evals (Language Model): `bash scripts\u002Frun_eval_needle.sh`\n- Multi Needle Evals (Language Model): `bash scripts\u002Frun_eval_needle_multi.sh`\n- Sampling images (Vision-Language Model): `bash scripts\u002Frun_sample_image.sh`\n- Sampling videos (Vision-LanguageModel): `bash scripts\u002Frun_sample_video.sh`\n- Image \u002F Video understanding (Vision-Language Model): `bash scripts\u002Frun_vision_chat.sh`\n\nBy default the `mesh_dim` argument puts all devices on `tp` (tensor parallelism). For longer sequences, you may want to include `sp`, which is the last dimension in the `mesh_dim`.\n\nWhen running needle evals, you may need to adjust the `theta` and `max_sequence_length` arguments in the scripts depending on the model. Below shows the correct values for each model.\n\n|                     | LWM-Text-128K \u002F  LWM-Text-Chat-128K | LWM-Text-256K \u002F  LWM-Text-Chat-256K | LWM-Text-512K \u002F LWM-Text-Chat-512K | LWM-Text-1M \u002F LWM-Text-Chat-1M |\n|---------------------|:-----------------------------------:|:-----------------------------------:|:----------------------------------:|:------------------------------:|\n| theta               |               10000000              |               10000000              |              25000000              |            50000000            |\n| max_sequence_length |                131072               |                262144               |               524288               |             1048576            |\n\n\nAn example of filling out a script (`run_sample_video.sh`) is as follows\n```bash\n#! \u002Fbin\u002Fbash\n\nexport SCRIPT_DIR=\"$( cd -- \"$( dirname -- \"${BASH_SOURCE[0]}\" )\" &> \u002Fdev\u002Fnull && pwd )\"\nexport PROJECT_DIR=\"$( cd -- \"$( dirname -- \"$SCRIPT_DIR\" )\" &> \u002Fdev\u002Fnull && pwd )\"\ncd $PROJECT_DIR\nexport PYTHONPATH=\"$PYTHONPATH:$PROJECT_DIR\"\n\nexport llama_tokenizer_path=\"LargeWorldModel\u002FLWM-Text-1M\"\nexport vqgan_checkpoint=\"\u002Fpath\u002Fto\u002Fckpt\u002Ffolder\u002Fvqgan\"\nexport lwm_checkpoint=\"params::\u002Fpath\u002Fto\u002Fckpt\u002Ffolder\u002Fparams\"\n\npython3 -u -m lwm.vision_generation \\\n    --prompt='Fireworks over the city' \\\n    --output_file='fireworks.mp4' \\\n    --temperature_image=1.0 \\\n    --temperature_video=1.0 \\\n    --top_k_image=8192 \\\n    --top_k_video=1000 \\\n    --cfg_scale_image=5.0 \\\n    --cfg_scale_video=1.0 \\\n    --vqgan_checkpoint=\"$vqgan_checkpoint\" \\\n    --n_frames=8 \\\n    --mesh_dim='!1,1,-1,1' \\\n    --dtype='fp32' \\\n    --load_llama_config='7b' \\\n    --update_llama_config=\"dict(sample_mode='vision',theta=50000000,max_sequence_length=32768,scan_attention=False,scan_query_chunk_size=128,scan_key_chunk_size=128,scan_mlp=False,scan_mlp_chunk_size=8192,scan_layers=True)\" \\\n    --load_checkpoint=\"$lwm_checkpoint\" \\\n    --tokenizer=\"$llama_tokenizer_path\"\nread\n```\n\n\n## Needle Haystack Data\nRun `python scripts\u002Fcreate_needle_data.py`\n\n\n## Running PyTorch Models\nOnly text and text chat models are currently supported for PyTorch inference. PyTorch models can be loaded as Hugging Face `LlamaForCausalLM` models. Run `python scripts\u002Fsample_pyt.py` to sample. You may need to separately install `torch`.\n\n## Documentation\n\nFor more details on the codebase, please refer to the [data.md](docs\u002Fdata.md) and [sharding.md](docs\u002Fsharding.md).\nThe [data.md](docs\u002Fdata.md) provides details on the data processing and the [sharding.md](docs\u002Fsharding.md) provides details on the sharding and parallelism.\n\n\n## If you have issues\n\nThis is based on the [codebase](https:\u002F\u002Fgithub.com\u002Fhaoliuhl\u002Fringattention) of RingAttention, with the necessary features for vision-language training. The training and inference have been tested on both TPUv3 and TPUv4.\n\nIf you encounter bugs, please open a GitHub issue!\n\n\n## Citation\n\nIf you use this codebase, or otherwise found our work valuable, please cite:\n\n```\n@article{liu2023world,\n    title={World Model on Million-Length Video and Language with RingAttention},\n    author={Liu, Hao and Yan, Wilson and Zaharia, Matei and Abbeel, Pieter},\n    journal={arXiv preprint},\n    year={2024},\n}\n@article{liu2023ring,\n    title={Ring Attention with Blockwise Transformers for Near-Infinite Context},\n    author={Liu, Hao and Zaharia, Matei and Abbeel, Pieter},\n    journal={International Conference on Learning Representations},\n    year={2024}\n}\n@article{liu2023blockwise,\n    title={Blockwise Parallel Transformer for Large Context Models},\n    author={Liu, Hao and Abbeel, Pieter},\n    journal={Advances in neural information processing systems},\n    year={2023}\n}\n```\n\n## License\n\nLWM's code is released under the Apache 2.0 License. See [LICENSE](https:\u002F\u002Fgithub.com\u002FLargeWorldModel\u002Flwm\u002Fblob\u002Fmain\u002FLICENSE) for further details. The models are released under the Llama-2 license.\n","# 大世界模型 (LWM)\n\n[[项目]](https:\u002F\u002Flargeworldmodel.github.io\u002F)\n[[论文]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.08268)\n[[模型]](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel)\n\n**大世界模型 (LWM)** 是一种通用的大上下文多模态自回归模型。它基于 RingAttention 技术，使用包含多样化长视频和书籍的大型数据集进行训练，能够执行语言、图像和视频的理解与生成任务。\n\n\n## 方法\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_2a766a6f08be.png\"\u002F>\n\u003C\u002Fdiv>\n\n当前的语言模型在理解那些难以用文字描述的世界方面存在不足，并且在处理复杂、长篇的任务时表现欠佳。视频序列提供了语言和静态图像所不具备的宝贵时间信息，因此非常适合与语言联合建模。这样的模型可以同时掌握人类的文本知识和物理世界的运行规律，从而赋予人工智能更广泛的能力来辅助人类。然而，从数百万个标记的视频和语言序列中学习面临着内存限制、计算复杂度高以及数据集有限等挑战。为应对这些难题，我们精心构建了一个包含多样化视频和书籍的大型数据集，采用 RingAttention 技术以可扩展的方式对长序列进行训练，并逐步将上下文长度从 4K 扩展到 1M 个标记。本文的主要贡献包括：(a) 拥有最大上下文长度的神经网络：我们在长视频和语言序列上训练了目前上下文长度最大的 Transformer 之一，在困难的检索任务和长视频理解方面树立了新的标杆。(b) 提出了克服视觉-语言训练挑战的解决方案，包括使用掩码序列打包技术混合不同长度的序列、通过损失加权平衡语言和视觉任务，以及利用模型生成的问答数据集进行长序列对话。(c) 开发了一套高度优化的实现方案，结合 RingAttention、掩码序列打包等关键技术，支持对百万级标记的多模态序列进行训练。(d) 完全开源了一组参数规模为 7B 的模型系列，这些模型能够处理超过 1M 个标记的长文本文档（LWM-Text、LWM-Text-Chat）和视频（LWM、LWM-Chat）。\n\n这项工作为基于海量长视频和语言数据集的训练铺平了道路，有助于开发对人类知识和多模态世界的理解能力，进而推动更广泛的人工智能应用。\n\n## LWM 的能力\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_2bae2237a373.png\"\u002F>\n  \u003Cp>\n  LWM 能够以高精度在 1M 上下文中检索事实。\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_c62a071ed8d8.png\"\u002F>\n  \u003Cp>\n  LWM 可以回答关于长达 1 小时 YouTube 视频的问题。\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_21bda4ebe3fb.png\"\u002F>\n  \u003Cp>\n  LWM 可以与图像进行对话。\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_readme_8f0cf6655c9d.png\"\u002F>\n  \u003Cp>\n  LWM 可以根据文本生成视频和图像。\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n\n## 环境搭建\n\n本代码库支持 Ubuntu 系统，尚未在 Windows 或 macOS 上测试过。我们建议使用 TPU 进行训练和推理，当然也可以使用 GPU。在 TPU 上，代码经过 Jax 的 Pallas 高度优化，能够在超大上下文长度下借助 RingAttention 实现极高的 MFU 值。而在 GPU 上，代码基于 XLA 架构，优化程度不及 TPU 版本。\n\n安装依赖项的命令如下：\n```\nconda create -n lwm python=3.10\nconda activate lwm\npip install -r gpu_requirements.txt\n```\n或者通过以下脚本设置 TPU 虚拟机环境：\n```\nsh tpu_requirements.sh\n```\n\n\n## 可用模型\n\n现有仅处理语言的版本和语言-视觉联合处理的版本，上下文长度分别为 32K、128K、256K 和 1M 个标记。其中，视觉-语言模型仅提供 Jax 版本，而仅语言模型则同时支持 PyTorch 和 Jax。以下是可用模型的名称、对应的上下文长度及功能：\n\n| 模型名称         | 上下文长度 | 语言或视觉-语言 | 对话版或基础版 | 链接                                                                                                                                          |\n|--------------------|--------------|-----------------------------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| LWM-Text-Chat-128K | 128K         | 语言                    | 对话版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-128K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-128K-Jax)] |\n| LWM-Text-Chat-256K | 256K         | 语言                    | 对话版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-256K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-256K-Jax)] |\n| LWM-Text-Chat-512K | 512K         | 语言                    | 对话版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-512K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-512K-Jax)] |\n| LWM-Text-Chat-1M   | 1M           | 语言                    | 对话版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-1M)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-Chat-1M-Jax)]     |\n| LWM-Text-128K      | 128K         | 语言                    | 基础版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-128K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-128K-Jax)]           |\n| LWM-Text-256K      | 256K         | 语言                    | 基础版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-256K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-256K-Jax)]           |\n| LWM-Text-512K      | 512K         | 语言                    | 基础版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-512K)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-512K-Jax)]           |\n| LWM-Text-1M        | 1M           | 语言                    | 基础版         | [[Pytorch](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-1M)][[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-Text-1M-Jax)]               |\n| LWM-Chat-32K       | 32K          | 视觉-语言             | 对话版         | [[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-32K-Jax)]                                                                                  |\n| LWM-Chat-128K      | 128K         | 视觉-语言             | 对话版         | [[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-128K-Jax)]                                                                                 |\n| LWM-Chat-1M        | 1M           | 视觉-语言             | 对话版         | [[Jax](https:\u002F\u002Fhuggingface.co\u002FLargeWorldModel\u002FLWM-1M-Jax)]                                                                                   |\n\n## 代码结构\n使用 `scan_query_chunk_size` 和 `scan_key_chunk_size` 来控制自注意力机制分块计算中的块大小。使用 `scan_mlp_chunk_size` 来控制前馈网络分块计算中的块大小。通过设置 `scan_attention=True` 和 `scan_mlp=True`，可以启用或禁用自注意力机制和前馈网络中的分块计算。\n\n您可以使用 `mesh_dim=dp, fsdp, tp, sp` 来控制并行度和 RingAttention 的配置。它是一个由逗号分隔的 4 个整数组成的字符串，分别表示数据并行、全切片数据并行、张量并行和序列并行的数量。\n\n例如，`mesh_dim='1,64,4,1'` 表示 1 个数据并行、64 个全切片数据并行、4 个张量并行和 1 个序列并行。而 `mesh_dim='1,1,4,64'` 则表示 1 个数据并行、1 个全切片数据并行、4 个张量并行以及 64 个序列并行，用于 RingAttention。\n\n## 运行 Jax 模型\n在这一部分，我们提供了如何运行每个提供的脚本的说明。对于每个脚本，您可能需要在脚本开头描述的变量中填写您自己的路径和值。\n\n要运行以下脚本，请使用 `bash \u003Cscript_name>.sh`：\n- 语言模型训练：`bash scripts\u002Frun_train_text.sh`\n- 视觉-语言模型训练：`bash scripts\u002Frun_train_vision_text.sh`\n- 单针评估（语言模型）：`bash scripts\u002Frun_eval_needle.sh`\n- 多针评估（语言模型）：`bash scripts\u002Frun_eval_needle_multi.sh`\n- 采样图像（视觉-语言模型）：`bash scripts\u002Frun_sample_image.sh`\n- 采样视频（视觉-语言模型）：`bash scripts\u002Frun_sample_video.sh`\n- 图像\u002F视频理解（视觉-语言模型）：`bash scripts\u002Frun_vision_chat.sh`\n\n默认情况下，`mesh_dim` 参数会将所有设备置于 `tp`（张量并行）模式。对于较长的序列，您可能希望加入 `sp`，即 `mesh_dim` 中的最后一个维度。\n\n在运行针刺评估时，您可能需要根据模型调整脚本中的 `theta` 和 `max_sequence_length` 参数。以下是各模型的正确取值：\n\n|                     | LWM-Text-128K \u002F  LWM-Text-Chat-128K | LWM-Text-256K \u002F  LWM-Text-Chat-256K | LWM-Text-512K \u002F LWM-Text-Chat-512K | LWM-Text-1M \u002F LWM-Text-Chat-1M |\n|---------------------|:-----------------------------------:|:-----------------------------------:|:----------------------------------:|:------------------------------:|\n| theta               |               10000000              |               10000000              |              25000000              |            50000000            |\n| max_sequence_length |                131072               |                262144               |               524288               |             1048576            |\n\n以下是填写脚本（`run_sample_video.sh`）的示例：\n```bash\n#! \u002Fbin\u002Fbash\n\nexport SCRIPT_DIR=\"$( cd -- \"$( dirname -- \"${BASH_SOURCE[0]}\" )\" &> \u002Fdev\u002Fnull && pwd )\"\nexport PROJECT_DIR=\"$( cd -- \"$( dirname -- \"$SCRIPT_DIR\" )\" &> \u002Fdev\u002Fnull && pwd )\"\ncd $PROJECT_DIR\nexport PYTHONPATH=\"$PYTHONPATH:$PROJECT_DIR\"\n\nexport llama_tokenizer_path=\"LargeWorldModel\u002FLWM-Text-1M\"\nexport vqgan_checkpoint=\"\u002Fpath\u002Fto\u002Fckpt\u002Ffolder\u002Fvqgan\"\nexport lwm_checkpoint=\"params::\u002Fpath\u002Fto\u002Fckpt\u002Ffolder\u002Fparams\"\n\npython3 -u -m lwm.vision_generation \\\n    --prompt='Fireworks over the city' \\\n    --output_file='fireworks.mp4' \\\n    --temperature_image=1.0 \\\n    --temperature_video=1.0 \\\n    --top_k_image=8192 \\\n    --top_k_video=1000 \\\n    --cfg_scale_image=5.0 \\\n    --cfg_scale_video=1.0 \\\n    --vqgan_checkpoint=\"$vqgan_checkpoint\" \\\n    --n_frames=8 \\\n    --mesh_dim='!1,1,-1,1' \\\n    --dtype='fp32' \\\n    --load_llama_config='7b' \\\n    --update_llama_config=\"dict(sample_mode='vision',theta=50000000,max_sequence_length=32768,scan_attention=False,scan_query_chunk_size=128,scan_key_chunk_size=128,scan_mlp=False,scan_mlp_chunk_size=8192,scan_layers=True)\" \\\n    --load_checkpoint=\"$lwm_checkpoint\" \\\n    --tokenizer=\"$llama_tokenizer_path\"\nread\n```\n\n\n## 针尖藏草堆数据\n运行 `python scripts\u002Fcreate_needle_data.py`\n\n\n## 运行 PyTorch 模型\n目前，PyTorch 推理仅支持文本和文本聊天模型。PyTorch 模型可以作为 Hugging Face 的 `LlamaForCausalLM` 模型加载。运行 `python scripts\u002Fsample_pyt.py` 进行采样。您可能需要单独安装 `torch`。\n\n## 文档\n\n有关代码库的更多详细信息，请参阅 [data.md](docs\u002Fdata.md) 和 [sharding.md](docs\u002Fsharding.md)。[data.md](docs\u002Fdata.md) 提供了关于数据处理的详细信息，而 [sharding.md](docs\u002Fsharding.md) 则介绍了分片和并行化方面的细节。\n\n## 如遇问题\n本项目基于 RingAttention 的 [代码库](https:\u002F\u002Fgithub.com\u002Fhaoliuhl\u002Fringattention)，并添加了视觉-语言训练所需的必要功能。训练和推理已在 TPUv3 和 TPUv4 上进行了测试。\n\n如果您遇到任何错误，请在 GitHub 上提交 issue！\n\n\n## 引用\n如果您使用了本代码库，或者以其他方式认为我们的工作有价值，请引用以下文献：\n\n```\n@article{liu2023world,\n    title={World Model on Million-Length Video and Language with RingAttention},\n    author={刘浩、颜威尔逊、扎哈里亚·马泰伊、阿贝尔·皮特},\n    journal={arXiv 预印本},\n    year={2024},\n}\n@article{liu2023ring,\n    title={Ring Attention with Blockwise Transformers for Near-Infinite Context},\n    author={刘浩、扎哈里亚·马泰伊、阿贝尔·皮特},\n    journal={国际学习表征会议},\n    year={2024}\n}\n@article{liu2023blockwise,\n    title={Blockwise Parallel Transformer for Large Context Models},\n    author={刘浩、阿贝尔·皮特},\n    journal={神经信息处理系统进展},\n    year={2023}\n}\n```\n\n## 许可证\nLWM 的代码采用 Apache 2.0 许可证发布。更多详情请参阅 [LICENSE](https:\u002F\u002Fgithub.com\u002FLargeWorldModel\u002Flwm\u002Fblob\u002Fmain\u002FLICENSE)。模型则采用 Llama-2 许可证发布。","# LWM (Large World Model) 快速上手指南\n\nLWM 是一个通用的大上下文多模态自回归模型，支持语言、图像和视频的理解与生成。它基于 RingAttention 技术训练，能够处理长达 100 万 token 的上下文（如长视频或书籍）。\n\n## 环境准备\n\n*   **操作系统**: 推荐 **Ubuntu**。代码库尚未在 Windows 或 macOS 上进行测试。\n*   **硬件加速**:\n    *   **TPU**: 强烈推荐。代码针对 Jax 的 Pallas 进行了高度优化，在使用 RingAttention 处理超大上下文时可实现极高的 MFU（模型浮点利用率）。\n    *   **GPU**: 支持。基于 XLA 实现，但优化程度不如 TPU 版本。\n*   **Python 版本**: 3.10\n\n## 安装步骤\n\n### 1. 创建虚拟环境\n```bash\nconda create -n lwm python=3.10\nconda activate lwm\n```\n\n### 2. 安装依赖\n根据使用的硬件选择以下一种方式：\n\n**方案 A：使用 GPU**\n```bash\npip install -r gpu_requirements.txt\n```\n*(注：如果原文未提供国内镜像源配置，建议在 pip 命令后添加 `-i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple` 以加速下载)*\n\n**方案 B：使用 TPU**\n```bash\nsh tpu_requirements.sh\n```\n\n## 基本使用\n\nLWM 提供多种预训练模型，包括纯文本模型（支持 PyTorch 和 Jax）和视 - 语多模态模型（仅支持 Jax）。\n\n### 1. 选择模型\n从 Hugging Face 获取模型权重。常用模型如下：\n*   **长文本对话**: `LWM-Text-Chat-1M` (支持 1M 上下文)\n*   **视频\u002F图像理解**: `LWM-Chat-1M` (仅 Jax, 支持 1M 上下文)\n\n### 2. 运行示例 (Jax 版本)\n以下示例展示如何使用 Jax 版本生成视频。请确保已设置好检查点路径。\n\n创建一个脚本文件（例如 `run_demo.sh`），内容如下：\n\n```bash\n#! \u002Fbin\u002Fbash\n\nexport SCRIPT_DIR=\"$( cd -- \"$( dirname -- \"${BASH_SOURCE[0]}\" )\" &> \u002Fdev\u002Fnull && pwd )\"\nexport PROJECT_DIR=\"$( cd -- \"$( dirname -- \"$SCRIPT_DIR\" )\" &> \u002Fdev\u002Fnull && pwd )\"\ncd $PROJECT_DIR\nexport PYTHONPATH=\"$PYTHONPATH:$PROJECT_DIR\"\n\n# 请替换为实际的模型路径和检查点路径\nexport llama_tokenizer_path=\"LargeWorldModel\u002FLWM-Text-1M\"\nexport vqgan_checkpoint=\"\u002Fpath\u002Fto\u002Fckpt\u002Ffolder\u002Fvqgan\"\nexport lwm_checkpoint=\"params::\u002Fpath\u002Fto\u002Fckpt\u002Ffolder\u002Fparams\"\n\npython3 -u -m lwm.vision_generation \\\n    --prompt='Fireworks over the city' \\\n    --output_file='fireworks.mp4' \\\n    --temperature_image=1.0 \\\n    --temperature_video=1.0 \\\n    --top_k_image=8192 \\\n    --top_k_video=1000 \\\n    --cfg_scale_image=5.0 \\\n    --cfg_scale_video=1.0 \\\n    --vqgan_checkpoint=\"$vqgan_checkpoint\" \\\n    --n_frames=8 \\\n    --mesh_dim='!1,1,-1,1' \\\n    --dtype='fp32' \\\n    --load_llama_config='7b' \\\n    --update_llama_config=\"dict(sample_mode='vision',theta=50000000,max_sequence_length=32768,scan_attention=False,scan_query_chunk_size=128,scan_key_chunk_size=128,scan_mlp=False,scan_mlp_chunk_size=8192,scan_layers=True)\" \\\n    --load_checkpoint=\"$lwm_checkpoint\" \\\n    --tokenizer=\"$llama_tokenizer_path\"\n```\n\n运行脚本：\n```bash\nbash run_demo.sh\n```\n\n### 3. 运行示例 (PyTorch 版本 - 仅限文本)\n如果您只需进行长文本推理，可以使用 PyTorch 版本，直接作为 Hugging Face 模型加载。\n\n确保已安装 `torch`，然后运行采样脚本：\n```bash\npython scripts\u002Fsample_pyt.py\n```\n*(注意：运行前需在脚本内部配置具体的模型路径和提示词)*\n\n### 关键参数说明\n*   `mesh_dim`: 控制并行策略。格式为 `dp,fsdp,tp,sp`。对于长序列推理，建议利用最后一个维度 `sp` (Sequence Parallelism) 来启用 RingAttention。例如：`mesh_dim='1,1,4,64'` 表示使用 64 路序列并行。\n*   `theta` 和 `max_sequence_length`: 在进行长上下文评估（如 Needle In A Haystack）时，需根据模型上下文大小调整这两个参数（详见原仓库表格）。","某安防审计团队需要分析长达数小时的监控录像，并从中精准定位特定异常事件及生成详细报告。\n\n### 没有 LWM 时\n- **上下文断裂**：传统模型受限于较短的上下文窗口（如 4K-32K tokens），必须将长视频切割成碎片处理，导致跨时间段的事件关联分析完全失效。\n- **关键信息遗漏**：在海量帧中检索微小细节（如“一小时前出现在走廊的红衣人”）如同大海捞针，准确率极低，极易漏掉关键线索。\n- **人工成本高昂**：分析师不得不人工观看完整录像或依赖多个独立工具拼接结果，耗时数小时才能完成一次初步排查。\n- **多模态理解割裂**：现有的文本模型无法直接理解视频中的动态物理世界变化，难以回答涉及时间序列推理的复杂问题。\n\n### 使用 LWM 后\n- **超长上下文贯通**：LWM 支持百万级 token 上下文，能一次性输入整段 1 小时以上的高清视频，完整保留时间线逻辑，实现全局关联分析。\n- **精准长程检索**：凭借在百万长度序列上的训练优势，LWM 能像“大海捞针”一样，从数小时视频中毫秒级定位并提取特定异常片段，准确率显著提升。\n- **自动化报告生成**：只需输入自然语言指令，LWM 即可直接理解视频内容并生成包含时间戳、行为描述的完整审计报告，将数小时工作压缩至分钟级。\n- **深度多模态推理**：LWM 同时理解文本知识与视频动态，能回答“嫌疑人在进入房间前是否接触过门把手”等需要结合视觉与逻辑推理的复杂问题。\n\nLWM 通过突破百万级多模态上下文限制，将长视频分析从“碎片化拼凑”升级为“全局化智能洞察”，彻底重塑了长时序数据的处理效率。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLargeWorldModel_LWM_e8fdbef3.png","LargeWorldModel","Large World Model","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FLargeWorldModel_a0868297.png","",null,"https:\u002F\u002Flargeworldmodel.github.io\u002F","https:\u002F\u002Fgithub.com\u002FLargeWorldModel",[83,87],{"name":84,"color":85,"percentage":86},"Python","#3572A5",92.7,{"name":88,"color":89,"percentage":90},"Shell","#89e051",7.3,7405,557,"2026-04-03T08:30:42","Apache-2.0",4,"Linux (Ubuntu)","非必需。支持 GPU，但代码基于 XLA 且针对 TPU 优化较少；推荐使用 TPU 进行训练和推理。未明确具体显卡型号、显存大小或 CUDA 版本要求。","未说明",{"notes":100,"python":101,"dependencies":102},"1. 该工具主要在 Ubuntu 上支持，未在 Windows 或 macOS 上测试。\n2. 强烈建议使用 TPU (v3\u002Fv4) 以获得最佳性能，特别是在处理百万级 token 上下文时，代码利用 Jax 的 Pallas 和 RingAttention 进行了高度优化。\n3. 视觉 - 语言模型（支持图像\u002F视频）仅支持 Jax 后端；纯文本模型支持 PyTorch 和 Jax 后端。\n4. 需通过 `gpu_requirements.txt` 或 `tpu_requirements.sh` 安装依赖。\n5. 运行长序列任务时，需配置 `mesh_dim` 参数以调整数据并行、张量并行和序列并行策略。","3.10",[103,104,105,106,107],"Jax","Pallas (Jax extension)","XLA","PyTorch (仅用于纯文本模型推理)","Hugging Face Transformers (用于加载 PyTorch 模型)",[26,14,52,54],"2026-03-27T02:49:30.150509","2026-04-06T06:55:38.746384",[112,117,122,127,132,136],{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},15257,"在 Ubuntu 22.04 (Python 3.11) 上安装时遇到 `tensorflow==2.11.0` 版本错误或依赖冲突怎么办？","该问题通常是由于 `torch` 和 `decord` 导入顺序的 bug 以及 Python 版本不兼容导致的。建议执行以下步骤：\n1. 删除并重新创建环境，推荐使用 Python 3.10。\n2. 卸载现有的 torch 和 torchvision。\n3. 按照以下命令安装 JAX (GPU 版本) 和其他依赖：\n```bash\nconda create -n lwm python=3.10\npip install -U \"jax[cuda12_pip]==0.4.23\" -f https:\u002F\u002Fstorage.googleapis.com\u002Fjax-releases\u002Fjax_cuda_releases.html\npip install -r requirements.txt\n```\n如果仍然有问题，尝试更新 flax, jax, chex 和 tux 到最新版本。","https:\u002F\u002Fgithub.com\u002FLargeWorldModel\u002FLWM\u002Fissues\u002F3",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},15258,"运行脚本时出现 `TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'` 错误如何解决？","这是 Python 版本不兼容导致的。代码中使用了 Python 3.10+ 支持的类型提示语法（如 `int | None`）。请确保您的环境使用的是 **Python 3.10** 或更高版本，不要使用 Python 3.9。可以通过以下命令检查并重建环境：\n```bash\npython --version # 确认是否为 3.10+\nconda create -n lwm python=3.10\n```","https:\u002F\u002Fgithub.com\u002FLargeWorldModel\u002FLWM\u002Fissues\u002F40",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},15259,"运行模型时遇到 `Out of memory` (显存不足) 错误，我的显卡是 8GB (如 RTX 2080 Super)，能运行吗？","无法运行。7B 参数量的模型如果使用 `fp32` 精度，仅模型权重就需要约 28GB 显存，这远超 8GB 显卡的能力。即使使用低精度，8GB 显存对于此类大模型推理也严重不足。建议更换具有更大显存（如 24GB+）的 GPU，或使用 TPU 环境。","https:\u002F\u002Fgithub.com\u002FLargeWorldModel\u002FLWM\u002Fissues\u002F37",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},15260,"在 Google Colab TPU Pro 上运行示例时卡住或报错 `Failed to open libtpu.so` 是什么原因？","这通常是因为资源不足或环境配置问题。日志显示 `No visible GPU devices` 且 `Failed to open libtpu.so`，表明后端初始化失败。主要原因可能是：\n1. Colab 实例的 RAM 或显存不足以加载模型。\n2. 未正确安装或链接 TPU 驱动库。\n建议检查 Colab 运行时设置是否正确选择了 TPU，并确保安装了与当前 JAX 版本匹配的 `libtpu`。如果资源仍然不足，可能需要升级到更高配置的实例。","https:\u002F\u002Fgithub.com\u002FLargeWorldModel\u002FLWM\u002Fissues\u002F8",{"id":133,"question_zh":134,"answer_zh":135,"source_url":126},15261,"如何正确配置环境变量和脚本来运行视觉对话模型 (Vision Chat)？","需要设置模型路径、分词器路径和输入文件路径，然后运行 python 模块。参考以下配置示例：\n```bash\nexport MODEL_NAME='LWM-Chat-32K-Jax'\nexport llama_tokenizer_path=\".\u002Fmodels\u002F${MODEL_NAME}\u002Ftokenizer.model\"\nexport vqgan_checkpoint=\".\u002Fmodels\u002F${MODEL_NAME}\u002Fvqgan\"\nexport lwm_checkpoint=\".\u002Fmodels\u002F${MODEL_NAME}\u002Fparams\"\nexport input_file=\".\u002Ftest_a.jpg\"\n\npython3 -u -m lwm.vision_chat \\\n    --prompt=\"What is the video about?\" \\\n    --input_file=\"$input_file\" \\\n    --vqgan_checkpoint=\"$vqgan_checkpoint\" \\\n    --mesh_dim='!1,1,8,1' \\\n    --dtype='fp32' \\\n    --load_llama_config='7b'\n```\n注意：`mesh_dim` 参数需根据实际硬件拓扑调整，如果单卡运行可能需要移除或修改该参数。",{"id":137,"question_zh":138,"answer_zh":139,"source_url":116},15262,"日志中出现 `Unable to initialize backend 'rocm'` 或 `tpu` 的警告信息会影响运行吗？","通常不会影响，只要您使用的是 NVIDIA GPU 且 CUDA 后端初始化成功即可。这些警告只是表示系统尝试加载 ROCM (AMD) 或 TPU 后端但未找到相应硬件或库。如果您看到 `Available platform names are: CUDA` 且后续没有报错，说明 GPU 后端已正常加载，可以忽略这些警告。",[]]