《DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter》(NeurIPS-2019)论文阅读

DistilBERT是一种通过知识蒸馏技术从大型BERT模型中提炼出的小型化版本,它在保持性能的同时显著减少了参数数量,提高了运行速度。本文介绍了DistilBERT的设计理念,包括去除token-type embeddings和pooler层,仅保留6层transformer,并采用特定的初始化和训练策略。

前言

Abstract

就是蒸馏bert,减少参数,加快速度。

1、Introduction

基于 Transformer 的与预训练的模型尺寸越来越大:

模型越来越大,速度也越来越慢,然后作者提出蒸馏的方法解决该问题。

作者在这篇论文中证明了使用预先经过知识蒸馏训练的小得多的语言模型可以在许多下游任务上达到相似的性能,从而使得模型在推理时更轻更快。

2、Knowledge distillation

这部分就介绍了经典的模型蒸馏的方法。有兴趣也可以去看我 FastbBert 的博客,里面也有介绍。

3、DistilBERT: a distilled version of BERT

  • 1、它的整体的模型很简单,就是将 Bert 中的 token-type embeddings 和 pooler 层移除,其它结构不变,然后只用6层 transformer。
  • 2、初始化学生网络,从 teacher 模型中每两层中抽取一层来初始化 student 模型。
  • 3、使用训练Bert的预料,来进行蒸馏训练。

没了。

感觉这篇论文简单粗暴,全程一个公式都没有,然后效果还不错,后面的论文动不动就把它拉出来吊打一顿。

- Value not in list: ckpt_name: 'ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors' not in [] # ComfyUI Error Report ## Error Details - **Node ID:** N/A - **Node Type:** N/A - **Exception Type:** 提示执行失败 - **Exception Message:** Prompt outputs failed validation: CheckpointLoaderSimple: - Value not in list: ckpt_name: 'ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors' not in [] ## Stack Trace ``` Error: Prompt execution failed at ComfyApi.queuePrompt (http://127.0.0.1:8188/assets/index-D1rfh02W.js:102021:13) at async ComfyApp.queuePrompt (http://127.0.0.1:8188/assets/index-D1rfh02W.js:390548:25) at async function (http://127.0.0.1:8188/assets/GraphView-DKd43ZLO.js:17521:9) at async http://127.0.0.1:8188/assets/index-D1rfh02W.js:261078:14 at async Proxy.execute (http://127.0.0.1:8188/assets/index-D1rfh02W.js:261431:7) at async queuePrompt (http://127.0.0.1:8188/assets/GraphView-DKd43ZLO.js:13756:7) ``` ## System Information - **ComfyUI Version:** 0.3.67 - **Arguments:** ComfyUI\main.py --windows-standalone-build - **OS:** nt - **Python Version:** 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [MSC v.1944 64 bit (AMD64)] - **Embedded Python:** true - **PyTorch Version:** 2.8.0+cu129 ## Devices - **Name:** cuda:0 NVIDIA GeForce GTX 1660 SUPER : cudaMallocAsync - **Type:** cuda - **VRAM Total:** 6442123264 - **VRAM Free:** 5383389184 - **Torch VRAM Total:** 0 - **Torch VRAM Free:** 0 ## Logs ``` 2025-10-31T10:13:09.142409 - [START] Security scan2025-10-31T10:13:09.142452 - 2025-10-31T10:13:13.258285 - [DONE] Security scan2025-10-31T10:13:13.258299 - 2025-10-31T10:13:13.376929 - ## ComfyUI-Manager: installing dependencies done.2025-10-31T10:13:13.380701 - 2025-10-31T10:13:13.383401 - ** ComfyUI startup time:2025-10-31T10:13:13.385297 - 2025-10-31T10:13:13.387273 - 2025-10-31 10:13:13.3832025-10-31T10:13:13.389289 - 2025-10-31T10:13:13.390412 - ** Platform:2025-10-31T10:13:13.390920 - 2025-10-31T10:13:13.392314 - Windows2025-10-31T10:13:13.392382 - 2025-10-31T10:13:13.392440 - ** Python version:2025-10-31T10:13:13.392494 - 2025-10-31T10:13:13.392544 - 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [MSC v.1944 64 bit (AMD64)]2025-10-31T10:13:13.392617 - 2025-10-31T10:13:13.392721 - ** Python executable:2025-10-31T10:13:13.392813 - 2025-10-31T10:13:13.392920 - D:\ComfyUI_windows_portable\python_embeded\python.exe2025-10-31T10:13:13.393127 - 2025-10-31T10:13:13.393188 - ** ComfyUI Path:2025-10-31T10:13:13.393225 - 2025-10-31T10:13:13.393259 - D:\ComfyUI_windows_portable\ComfyUI2025-10-31T10:13:13.393294 - 2025-10-31T10:13:13.393329 - ** ComfyUI Base Folder Path:2025-10-31T10:13:13.393362 - 2025-10-31T10:13:13.393396 - D:\ComfyUI_windows_portable\ComfyUI2025-10-31T10:13:13.393429 - 2025-10-31T10:13:13.393465 - ** User directory:2025-10-31T10:13:13.393498 - 2025-10-31T10:13:13.393531 - D:\ComfyUI_windows_portable\ComfyUI\user2025-10-31T10:13:13.393566 - 2025-10-31T10:13:13.393600 - ** ComfyUI-Manager config path:2025-10-31T10:13:13.393637 - 2025-10-31T10:13:13.393802 - D:\ComfyUI_windows_portable\ComfyUI\user\default\ComfyUI-Manager\config.ini2025-10-31T10:13:13.393846 - 2025-10-31T10:13:13.393889 - ** Log path:2025-10-31T10:13:13.393919 - 2025-10-31T10:13:13.393948 - D:\ComfyUI_windows_portable\ComfyUI\user\comfyui.log2025-10-31T10:13:13.393978 - 2025-10-31T10:13:14.594910 - Prestartup times for custom nodes: 2025-10-31T10:13:14.595096 - 8.5 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager-main 2025-10-31T10:13:14.595269 - 2025-10-31T10:13:20.347414 - Checkpoint files will always be loaded safely. 2025-10-31T10:13:20.465905 - Total VRAM 6144 MB, total RAM 32605 MB 2025-10-31T10:13:20.466152 - pytorch version: 2.8.0+cu129 2025-10-31T10:13:20.466526 - Set vram state to: NORMAL_VRAM 2025-10-31T10:13:20.466874 - Device: cuda:0 NVIDIA GeForce GTX 1660 SUPER : cudaMallocAsync 2025-10-31T10:13:23.542557 - Using pytorch attention 2025-10-31T10:13:51.813379 - Python version: 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [MSC v.1944 64 bit (AMD64)] 2025-10-31T10:13:51.813640 - ComfyUI version: 0.3.67 2025-10-31T10:13:51.867449 - ComfyUI frontend version: 1.28.8 2025-10-31T10:13:51.869341 - [Prompt Server] web root: D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfyui_frontend_package\static 2025-10-31T10:13:55.041241 - ### Loading: ComfyUI-Manager (V3.37) 2025-10-31T10:13:55.043206 - [ComfyUI-Manager] network_mode: public 2025-10-31T10:13:55.208579 - ### ComfyUI Revision: 170 [f2bb3230] *DETACHED | Released on '2025-10-28' 2025-10-31T10:13:55.929065 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json 2025-10-31T10:13:56.082303 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json 2025-10-31T10:13:56.260659 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json 2025-10-31T10:13:56.507549 - Import times for custom nodes: 2025-10-31T10:13:56.507810 - 0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py 2025-10-31T10:13:56.507931 - 0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\noan-banana 2025-10-31T10:13:56.507998 - 0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\gemini_node 2025-10-31T10:13:56.508058 - 0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\clybschromanodes 2025-10-31T10:13:56.508243 - 0.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager-main 2025-10-31T10:13:56.508338 - 0.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-kjnodes 2025-10-31T10:13:56.508404 - 1.3 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite-main 2025-10-31T10:13:56.508480 - 1.7 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-LTXVideo 2025-10-31T10:13:56.508537 - 2025-10-31T10:13:56.595420 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json 2025-10-31T10:13:56.647428 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json 2025-10-31T10:13:57.293810 - Context impl SQLiteImpl. 2025-10-31T10:13:57.294932 - Will assume non-transactional DDL. 2025-10-31T10:13:57.296045 - No target revision found. 2025-10-31T10:13:57.310263 - Starting server 2025-10-31T10:13:57.310958 - To see the GUI go to: http://127.0.0.1:8188 2025-10-31T10:13:58.672410 - [DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version. 2025-10-31T10:13:58.674099 - [DEPRECATION WARNING] Detected import of deprecated legacy API: /extensions/core/groupNode.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version. 2025-10-31T10:13:58.679303 - [DEPRECATION WARNING] Detected import of deprecated legacy API: /extensions/core/widgetInputs.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version. 2025-10-31T10:13:59.021837 - [DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui/components/buttonGroup.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version. 2025-10-31T10:13:59.027778 - [DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui/components/button.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version. 2025-10-31T10:14:04.930152 - FETCH ComfyRegistry Data: 5/1032025-10-31T10:14:04.930831 - 2025-10-31T10:14:11.885304 - FETCH ComfyRegistry Data: 10/1032025-10-31T10:14:11.886608 - 2025-10-31T10:14:18.996533 - FETCH ComfyRegistry Data: 15/1032025-10-31T10:14:18.996705 - 2025-10-31T10:14:25.923527 - FETCH ComfyRegistry Data: 20/1032025-10-31T10:14:25.924409 - 2025-10-31T10:14:33.063630 - FETCH ComfyRegistry Data: 25/1032025-10-31T10:14:33.064614 - 2025-10-31T10:14:40.115851 - FETCH ComfyRegistry Data: 30/1032025-10-31T10:14:40.116668 - 2025-10-31T10:14:47.264312 - FETCH ComfyRegistry Data: 35/1032025-10-31T10:14:47.264805 - 2025-10-31T10:14:54.223473 - FETCH ComfyRegistry Data: 40/1032025-10-31T10:14:54.224882 - 2025-10-31T10:15:01.556335 - FETCH ComfyRegistry Data: 45/1032025-10-31T10:15:01.558179 - 2025-10-31T10:15:08.613167 - FETCH ComfyRegistry Data: 50/1032025-10-31T10:15:08.613459 - 2025-10-31T10:15:15.734947 - FETCH ComfyRegistry Data: 55/1032025-10-31T10:15:15.736272 - 2025-10-31T10:15:22.989793 - FETCH ComfyRegistry Data: 60/1032025-10-31T10:15:22.989882 - 2025-10-31T10:15:29.978864 - FETCH ComfyRegistry Data: 65/1032025-10-31T10:15:29.978954 - 2025-10-31T10:15:37.244288 - FETCH ComfyRegistry Data: 70/1032025-10-31T10:15:37.244384 - 2025-10-31T10:15:45.518913 - FETCH ComfyRegistry Data: 75/1032025-10-31T10:15:45.519117 - 2025-10-31T10:15:53.616068 - FETCH ComfyRegistry Data: 80/1032025-10-31T10:15:53.617325 - 2025-10-31T10:15:55.559015 - Cannot connect to comfyregistry.2025-10-31T10:15:55.560254 - 2025-10-31T10:15:55.562954 - FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json2025-10-31T10:15:55.563346 - 2025-10-31T10:15:57.647736 - [ComfyUI-Manager] Due to a network error, switching to local mode. => custom-node-list.json => Cannot connect to host 127.0.0.1:7897 ssl:default [远程计算机拒绝网络连接。] 2025-10-31T10:15:57.647860 - FETCH DATA from: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager-main\custom-node-list.json2025-10-31T10:15:57.647918 - 2025-10-31T10:15:57.687674 - [DONE]2025-10-31T10:15:57.688893 - 2025-10-31T10:15:57.710555 - [ComfyUI-Manager] All startup tasks have been completed. 2025-10-31T10:16:38.408557 - got prompt 2025-10-31T10:16:38.416664 - Failed to validate prompt for output 1336: 2025-10-31T10:16:38.416968 - * CheckpointLoaderSimple 1896: 2025-10-31T10:16:38.417218 - - Value not in list: ckpt_name: 'ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors' not in [] 2025-10-31T10:16:38.417466 - Output will be ignored 2025-10-31T10:16:38.417901 - Failed to validate prompt for output 1973: 2025-10-31T10:16:38.418187 - Output will be ignored 2025-10-31T10:16:38.418384 - invalid prompt: {'type': 'prompt_outputs_failed_validation', 'message': 'Prompt outputs failed validation', 'details': '', 'extra_info': {}} ``` ## Attached Workflow Please make sure that workflow does not contain any sensitive information such as API keys or passwords. ``` Workflow too large. Please manually upload the workflow from local file system. ``` ## Additional Context (Please add any additional context or steps to reproduce the error here)
最新发布
11-01
<think>我们正在处理ComfyUI 0.3.67版本中出现的错误:'Value not in list: ckpt_name: 'ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors' not in []' 根据错误信息,系统在加载模型时,尝试加载一个名为'ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors'的检查点文件,但是在可用文件列表([])中找不到它,因此报错。 结合引用内容,我们知道LTX-Video的模型文件命名规范为:ltxv-[模型规模]-[版本号]-[特性标记].safetensors。例如: - ltxv-13b-0.9.8-dev.safetensors(开发版13B模型) - ltxv-2b-0.9.8-distilled-fp8.safetensors(FP8量化的2B蒸馏模型) 但是错误信息中的文件路径为:`ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors`,这看起来是一个多文件模型(因为模型被分成了多个部分,如00004-of-00004)。然而,在ComfyUI中,通常我们使用单个检查点文件(.ckpt或.safetensors)来加载模型。因此,这里的问题可能是模型文件结构不符合ComfyUI的预期。 解决方案步骤: 1. **确认模型文件结构**: - 检查模型下载后的目录结构。根据错误信息,模型目录为`ltxv\LTX-Video-0.9.8-13B-distilled`,里面有一个子目录`ltx-video`,再下一级是`text_encoder`,然后才是模型文件`model-00004-of-00004.safetensors`。这种结构常见于Hugging Face模型仓库,其中模型被分成多个分片(shards)存储。 - 但是,ComfyUI通常期望模型是一个单独的文件(比如一个完整的.safetensors文件)。因此,我们需要将分片文件合并成一个完整的模型文件。 2. **合并模型分片**: - 使用Hugging Face提供的工具`transformers`库或者`safetensors`库来合并分片。具体步骤: - 安装必要的库:`pip install transformers safetensors` - 使用以下Python脚本进行合并(注意替换路径): ```python from transformers import AutoModel import os # 指定模型目录(包含多个分片文件的目录) model_path = "ltxv/LTX-Video-0.9.8-13B-distilled/ltx-video/text_encoder" # 加载模型(transformers会自动合并分片) model = AutoModel.from_pretrained(model_path) # 保存为单个文件 model.save_pretrained("合并后的目录", safe_serialization=True) ``` 这样,会在“合并后的目录”中生成一个完整的`safetensors`文件(通常命名为`model.safetensors`)。 - 或者,如果模型已经提供了合并脚本,请使用官方提供的脚本。 3. **修改ComfyUI配置**: - 将合并后的单个模型文件(例如`model.safetensors`)放入ComfyUI的模型目录中(通常是`ComfyUI/models/checkpoints`)。 - 在ComfyUI中,确保在加载模型时指向这个新文件。 4. **检查配置文件**: - 根据引用[^1],模型需要匹配对应的配置文件。在合并模型后,可能需要相应的配置文件(如`config.json`)。确保从原始模型目录中复制`config.json`到合并后的目录,或者在使用时指定配置文件。 5. **更新ComfyUI或相关节点**: - 如果问题仍然存在,可能是ComfyUI版本不支持多文件模型加载。考虑升级ComfyUI到最新版本,或者检查是否有专门支持多文件模型的节点(custom node)。 6. **使用绝对路径**: - 如果错误是由于路径问题,尝试使用绝对路径指定模型文件。 7. **检查模型文件名**: - 确保在ComfyUI的配置中,模型文件名(不包括路径)与合并后的文件名一致。例如,在加载模型中,指定模型为`model.safetensors`(或你保存的文件名)。 8. **重新启动ComfyUI**: - 在完成上述步骤后,重启ComfyUI以使更改生效。 注意:由于模型较大(13B),合并过程需要足够的磁盘空间(至少是模型分片总大小的两倍)和一定的时间。 如果以上步骤无法解决问题,请考虑在ComfyUI的GitHub仓库中搜索类似问题或提交issue,说明错误和尝试的步骤。 相关问题: 1. 如何合并Hugging Face模型的分片文件? 2. ComfyUI支持哪些模型文件格式? 3. 在ComfyUI中如何配置模型加载路径? </think>基于ComfyUI 0.3.67版本中出现的`Value not in list: ckpt_name`错误,以下是系统化的解决方案: ### 错误分析 错误信息表明: ```plaintext 'ltxv\LTX-Video-0.9.8-13B-distilled\ltx-video\text_encoder\model-00004-of-00004.safetensors' not in [] ``` 关键问题: 1. **路径匹配失败**:ComfyUI无法在模型目录中找到指定文件 2. **多文件模型加载问题**:LTX-Video模型的`text_encoder`组件被拆分为多个分片文件(如00004-of-00004) 3. **配置文件缺失**:缺少与模型匹配的配置文件(根据引用规范[^1]) ### 解决方案 #### 步骤1:验证文件结构 确保模型目录符合LTX-Video规范[^1]: ``` LTX-Video-0.9.8-13B-distilled/ ├── ltx-video/ │ ├── text_encoder/ │ │ ├── model-00001-of-00004.safetensors │ │ ├── ... │ │ └── model-00004-of-00004.safetensors // 确保此文件存在 │ └── config.json // 关键配置文件 └── model_index.json ``` **检查点**: - 确认`model-00004-of-00004.safetensors`实际存在于路径中 - 验证所有分片文件完整(共4个文件) #### 步骤2:修复配置文件 1. 创建/修改`config.json`: ```json { "_name_or_path": "ltxv/LTX-Video-0.9.8-13B-distilled", "architectures": ["LTXVideoModel"], "model_type": "ltxv", "distilled": true, "quantization": "fp16" // 根据实际类型调整 } ``` 2. 在模型根目录添加`model_index.json`: ```json { "text_encoder": "ltx-video/text_encoder" } ``` #### 步骤3:修改ComfyUI加载逻辑 在`ComfyUI/custom_nodes/ltxv_node.py`中修改代码: ```python # 原错误代码(尝试加载单个文件): # ckpt_name = "ltxv/LTX-Video-0.9.8-13B-distilled/ltx-video/text_encoder/model.safetensors" # 修正为多文件加载模式: ckpt_path = os.path.join(model_dir, "ltx-video/text_encoder") // 指向目录而非单个文件 model = LTXVideoModel.from_pretrained(ckpt_path) // 自动加载分片 ``` #### 步骤4:环境验证 执行诊断脚本: ```python import os model_path = "ltxv/LTX-Video-0.9.8-13B-distilled" print("存在的文件:", os.listdir(f"{model_path}/ltx-video/text_encoder")) # 应输出: ['model-00001-of-00004.safetensors', ... , 'model-00004-of-00004.safetensors'] ``` ### 预防措施 1. **文件校验**:下载模型后运行校验脚本 ```bash sha256sum ltx-video/text_encoder/*.safetensors ``` 2. **版本兼容**:确保使用支持多文件加载的ComfyUI扩展(v0.3.67+) 3. **路径规范**:始终使用Unix风格路径`ltxv/LTX-Video...`(避免Windows反斜杠) > 此解决方案基于LTX-Video模型的分片加载特性和ComfyUI的模块化架构设计[^1]。实际操作中若存在版本差异,需检查扩展节点的GitHub文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值