[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-bigcode-project--starcoder":3,"tool-bigcode-project--starcoder":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},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,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},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 真正成长为懂上",158594,2,"2026-04-16T23:34:05",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":78,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":10,"env_os":91,"env_gpu":92,"env_ram":93,"env_deps":94,"category_tags":106,"github_topics":77,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":107,"updated_at":108,"faqs":109,"releases":138},8307,"bigcode-project\u002Fstarcoder","starcoder","Home of StarCoder: fine-tuning & inference!","StarCoder 是一款专为编程领域打造的大型语言模型，由 Hugging Face 与 BigCode 社区联合开源。它不仅能理解自然语言指令，更能精通超过 80 种编程语言，擅长根据上下文自动补全代码片段、生成完整函数甚至修复潜在错误。\n\n对于开发者而言，StarCoder 就像一位随叫随到的智能编程助手，能有效减少重复性编码工作，提升开发效率；对于研究人员，它提供了基于 GitHub 海量代码库、Issues 及笔记数据训练的高质量基座，支持在特定任务上进行微调和深度探索。其独特之处在于训练数据不仅包含纯净的代码，还融合了技术讨论和文档内容，使其对编程意图的理解更加精准。此外，项目提供了便捷的微调指南和推理接口，并配套了 VS Code 插件，让用户能轻松将其集成到日常开发流中。无论是希望优化工作流的软件工程师，还是致力于代码智能研究的数据科学家，StarCoder 都是一个强大且易上手的开源选择。使用前只需在 Hugging Face 平台接受相关协议，即可通过简单的几行代码启动您的智能编码之旅。","# 💫 StarCoder\n\n[Paper](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1cN-b9GnWtHzQRoE7M7gAEyivY0kl4BYs\u002Fview) | [Model](https:\u002F\u002Fhuggingface.co\u002Fbigcode\u002Fstarcoder) | [Playground](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fbigcode\u002Fbigcode-playground) | [VSCode](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=HuggingFace.huggingface-vscode) | [Chat](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FHuggingFaceH4\u002Fstarchat-playground)\n\n# What is this about?\n💫 StarCoder is a language model (LM) trained on source code and natural language text. Its training data incorporates more that 80 different programming languages as well as text extracted from GitHub issues and commits and from notebooks. This repository showcases how we get an overview of this LM's capabilities.\n\n# News\n\n* **May 9, 2023:** We've fine-tuned StarCoder to act as a helpful coding assistant 💬! Check out the `chat\u002F` directory for the training code and play with the model [here](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FHuggingFaceH4\u002Fstarchat-playground).\n\n# Disclaimer\n\nBefore you can use the model go to `hf.co\u002Fbigcode\u002Fstarcoder` and accept the agreement. And make sure you are logged into the Hugging Face hub with:\n```bash\nhuggingface-cli login\n```\n\n# Table of Contents\n1. [Quickstart](#quickstart)\n    - [Installation](#installation)\n    - [Code generation with StarCoder](#code-generation)\n    - [Text-generation-inference code](#text-generation-inference)\n2. [Fine-tuning](#fine-tuning)\n    - [Step by step installation with conda](#step-by-step-installation-with-conda)\n    - [Datasets](#datasets)\n      - [Stack Exchange](#stack-exchange-se)\n    - [Merging PEFT adapter layers](#merging-peft-adapter-layers)\n3. [Evaluation](#evaluation)\n4. [Inference hardware requirements](#inference-hardware-requirements)\n\n# Quickstart\nStarCoder was trained on GitHub code, thus it can be used to perform code generation. More precisely, the model can complete the implementation of a function or infer the following characters in a line of code. This can be done with the help of the 🤗's [transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers) library.\n\n## Installation\nFirst, we have to install all the libraries listed in `requirements.txt`\n```bash\npip install -r requirements.txt\n```\n## Code generation\nThe code generation pipeline is as follows\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ncheckpoint = \"bigcode\u002Fstarcoder\"\ndevice = \"cuda\" # for GPU usage or \"cpu\" for CPU usage\n\ntokenizer = AutoTokenizer.from_pretrained(checkpoint)\n# to save memory consider using fp16 or bf16 by specifying torch_dtype=torch.float16 for example\nmodel = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)\n\ninputs = tokenizer.encode(\"def print_hello_world():\", return_tensors=\"pt\").to(device)\noutputs = model.generate(inputs)\n# clean_up_tokenization_spaces=False prevents a tokenizer edge case which can result in spaces being removed around punctuation\nprint(tokenizer.decode(outputs[0], clean_up_tokenization_spaces=False))\n```\nor\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\ncheckpoint = \"bigcode\u002Fstarcoder\"\n\nmodel = AutoModelForCausalLM.from_pretrained(checkpoint)\ntokenizer = AutoTokenizer.from_pretrained(checkpoint)\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer, device=0)\nprint( pipe(\"def hello():\") )\n```\nFor hardware requirements, check the section [Inference hardware requirements](#inference-hardware-requirements).\n\n## Text-generation-inference\n\n```bash\ndocker run -p 8080:80 -v $PWD\u002Fdata:\u002Fdata -e HUGGING_FACE_HUB_TOKEN=\u003CYOUR BIGCODE ENABLED TOKEN> -d  ghcr.io\u002Fhuggingface\u002Ftext-generation-inference:latest --model-id bigcode\u002Fstarcoder --max-total-tokens 8192\n```\nFor more details, see [here](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftext-generation-inference).\n\n# Fine-tuning\n\nHere, we showcase how we can fine-tune this LM on a specific downstream task.\n\n## Step by step installation with conda \n\nCreate a new conda environment and activate it\n```bash\nconda create -n env\nconda activate env\n```\nInstall the `pytorch` version compatible with your version of cuda [here](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Fprevious-versions\u002F), for example the following command works with cuda 11.6\n```bash\nconda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia\n```\nInstall `transformers` and `peft`\n```bash\nconda install -c huggingface transformers \npip install git+https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft.git\n```\nNote that you can install the latest stable version of transformers by using\n\n```bash\npip install git+https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\n```\n\nInstall `datasets`, `accelerate` and `huggingface_hub`\n\n```bash\nconda install -c huggingface -c conda-forge datasets\nconda install -c conda-forge accelerate\nconda install -c conda-forge huggingface_hub\n```\n\nFinally, install `bitsandbytes` and `wandb`\n```bash\npip install bitsandbytes\npip install wandb\n```\nTo get the full list of arguments with descriptions you can run the following command on any script:\n```\npython scripts\u002Fsome_script.py --help\n```\nBefore you run any of the scripts make sure you are logged in and can push to the hub:\n```bash\nhuggingface-cli login\n```\nMake sure you are logged in `wandb`:\n```bash\nwandb login\n```\nNow that everything is done, you can clone the repository and get into the corresponding directory.\n\n## Datasets\n💫 StarCoder can be fine-tuned to achieve multiple downstream tasks. Our interest here is to fine-tune StarCoder in order to make it follow instructions. [Instruction fine-tuning](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2109.01652.pdf) has gained a lot of attention recently as it proposes a simple framework that teaches language models to align their outputs with human needs. That procedure requires the availability of quality instruction datasets, which contain multiple `instruction - answer` pairs. Unfortunately such datasets are not ubiquitous but thanks to Hugging Face 🤗's [datasets](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdatasets) library we can have access to some good proxies. To fine-tune cheaply and efficiently, we use Hugging Face 🤗's [PEFT](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft) as well as Tim Dettmers' [bitsandbytes](https:\u002F\u002Fgithub.com\u002FTimDettmers\u002Fbitsandbytes).\n\n\n### Stack Exchange SE\n[Stack Exchange](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FStack_Exchange) is a well-known network of Q&A websites on topics in diverse fields. It is a place where a user can ask a question and obtain answers from other users. Those answers are scored and ranked based on their quality. [Stack exchange instruction](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FArmelR\u002Fstack-exchange-instruction) is a dataset that was obtained by scrapping the site in order to build a collection of Q&A pairs. A language model can then be fine-tuned on that dataset to make it elicit strong and diverse question-answering skills.\n\nTo execute the fine-tuning script run the following command:\n```bash\npython finetune\u002Ffinetune.py \\\n  --model_path=\"bigcode\u002Fstarcoder\"\\\n  --dataset_name=\"ArmelR\u002Fstack-exchange-instruction\"\\\n  --subset=\"data\u002Ffinetune\"\\\n  --split=\"train\"\\\n  --size_valid_set 10000\\\n  --streaming\\\n  --seq_length 2048\\\n  --max_steps 1000\\\n  --batch_size 1\\\n  --input_column_name=\"question\"\\\n  --output_column_name=\"response\"\\ \n  --gradient_accumulation_steps 16\\\n  --learning_rate 1e-4\\\n  --lr_scheduler_type=\"cosine\"\\\n  --num_warmup_steps 100\\\n  --weight_decay 0.05\\\n  --output_dir=\".\u002Fcheckpoints\" \\\n```\nThe size of the SE dataset is better manageable when using streaming. We also have to precise the split of the dataset that is used. For more details, check the [dataset's page](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FArmelR\u002Fstack-exchange-instruction) on 🤗. Similarly we can modify the command to account for the availability of GPUs\n\n```bash\npython -m torch.distributed.launch \\\n  --nproc_per_node number_of_gpus finetune\u002Ffinetune.py \\\n  --model_path=\"bigcode\u002Fstarcoder\"\\\n  --dataset_name=\"ArmelR\u002Fstack-exchange-instruction\"\\\n  --subset=\"data\u002Ffinetune\"\\\n  --split=\"train\"\\\n  --size_valid_set 10000\\\n  --streaming \\\n  --seq_length 2048\\\n  --max_steps 1000\\\n  --batch_size 1\\\n  --input_column_name=\"question\"\\\n  --output_column_name=\"response\"\\ \n  --gradient_accumulation_steps 16\\\n  --learning_rate 1e-4\\\n  --lr_scheduler_type=\"cosine\"\\\n  --num_warmup_steps 100\\\n  --weight_decay 0.05\\\n  --output_dir=\".\u002Fcheckpoints\" \\\n```\n## Merging PEFT adapter layers\nIf you train a model with PEFT, you'll need to merge the adapter layers with the base model if you want to run inference \u002F evaluation. To do so, run:\n```bash\npython finetune\u002Fmerge_peft_adapters.py --base_model_name_or_path model_to_merge --peft_model_path model_checkpoint\n\n# Push merged model to the Hub\npython finetune\u002Fmerge_peft_adapters.py --base_model_name_or_path model_to_merge --peft_model_path model_checkpoint --push_to_hub\n```\nFor example\n\n```bash\npython finetune\u002Fmerge_peft_adapters.py --model_name_or_path bigcode\u002Fstarcoder --peft_model_path checkpoints\u002Fcheckpoint-1000 --push_to_hub\n```\n\n# Evaluation\nTo evaluate StarCoder and its derivatives, you can use the [BigCode-Evaluation-Harness](https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fbigcode-evaluation-harness) for evaluating Code LLMs.\n\n# Inference hardware requirements\nIn FP32 the model requires more than 60GB of RAM, you can load it in FP16 or BF16 in ~30GB, or in 8bit under 20GB of RAM with\n```python\n# make sure you have accelerate and bitsandbytes installed\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ntokenizer = AutoTokenizer.from_pretrained(\"bigcode\u002Fstarcoder\")\n# for fp16 replace with  `load_in_8bit=True` with   `torch_dtype=torch.float16`\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode\u002Fstarcoder\", device_map=\"auto\", load_in_8bit=True)\nprint(f\"Memory footprint: {model.get_memory_footprint() \u002F 1e6:.2f} MB\")\n````\n```\nMemory footprint: 15939.61 MB\n```\nYou can also try [starcoder.cpp](https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fstarcoder.cpp), a C++ implementation with [ggml](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fggml) library.\n","# 💫 StarCoder\n\n[论文](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1cN-b9GnWtHzQRoE7M7gAEyivY0kl4BYs\u002Fview) | [模型](https:\u002F\u002Fhuggingface.co\u002Fbigcode\u002Fstarcoder) | [体验平台](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fbigcode\u002Fbigcode-playground) | [VSCode 插件](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=HuggingFace.huggingface-vscode) | [聊天界面](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FHuggingFaceH4\u002Fstarchat-playground)\n\n# 这个项目是关于什么的？\n💫 StarCoder 是一个基于源代码和自然语言文本训练的语言模型。其训练数据涵盖了 80 多种编程语言，以及从 GitHub 问题、提交记录和 Notebook 中提取的文本。本仓库展示了我们如何全面了解该语言模型的能力。\n\n# 最新消息\n\n* **2023年5月9日：** 我们对 StarCoder 进行了微调，使其能够作为一位有用的编程助手 💬！请查看 `chat\u002F` 目录中的训练代码，并在此处与模型互动 [这里](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FHuggingFaceH4\u002Fstarchat-playground)。\n\n# 免责声明\n\n在使用该模型之前，请前往 `hf.co\u002Fbigcode\u002Fstarcoder` 并接受相关协议。同时确保您已登录 Hugging Face Hub：\n```bash\nhuggingface-cli login\n```\n\n# 目录\n1. [快速入门](#quickstart)\n    - [安装](#installation)\n    - [使用 StarCoder 进行代码生成](#code-generation)\n    - [文本生成推理代码](#text-generation-inference)\n2. [微调](#fine-tuning)\n    - [使用 Conda 的逐步安装指南](#step-by-step-installation-with-conda)\n    - [数据集](#datasets)\n      - [Stack Exchange](#stack-exchange-se)\n    - [合并 PEFT Adapter 层](#merging-peft-adapter-layers)\n3. [评估](#evaluation)\n4. [推理硬件要求](#inference-hardware-requirements)\n\n# 快速入门\nStarCoder 是在 GitHub 代码上训练的，因此它可以用于代码生成任务。具体来说，该模型可以完成函数的实现，或者推断出代码行中接下来的内容。这可以通过 🤗 的 [transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers) 库来实现。\n\n## 安装\n首先，我们需要安装 `requirements.txt` 文件中列出的所有库：\n```bash\npip install -r requirements.txt\n```\n## 代码生成\n代码生成流程如下：\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ncheckpoint = \"bigcode\u002Fstarcoder\"\ndevice = \"cuda\" # 使用 GPU 或 \"cpu\" 使用 CPU\n\ntokenizer = AutoTokenizer.from_pretrained(checkpoint)\n# 为节省显存，可考虑使用 fp16 或 bf16，例如指定 torch_dtype=torch.float16\nmodel = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)\n\ninputs = tokenizer.encode(\"def print_hello_world():\", return_tensors=\"pt\").to(device)\noutputs = model.generate(inputs)\n# clean_up_tokenization_spaces=False 可防止分词器的一个边缘情况，即标点符号周围的空格被移除\nprint(tokenizer.decode(outputs[0], clean_up_tokenization_spaces=False))\n```\n或者\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\ncheckpoint = \"bigcode\u002Fstarcoder\"\n\nmodel = AutoModelForCausalLM.from_pretrained(checkpoint)\ntokenizer = AutoTokenizer.from_pretrained(checkpoint)\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer, device=0)\nprint( pipe(\"def hello():\") )\n```\n有关硬件要求，请参阅 [推理硬件要求](#inference-hardware-requirements) 部分。\n\n## 文本生成推理\n\n```bash\ndocker run -p 8080:80 -v $PWD\u002Fdata:\u002Fdata -e HUGGING_FACE_HUB_TOKEN=\u003CYOUR BIGCODE ENABLED TOKEN> -d  ghcr.io\u002Fhuggingface\u002Ftext-generation-inference:latest --model-id bigcode\u002Fstarcoder --max-total-tokens 8192\n```\n更多详情请参见 [这里](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftext-generation-inference)。\n\n# 微调\n\n在这里，我们将展示如何针对特定下游任务对该语言模型进行微调。\n\n## 使用 Conda 的逐步安装指南\n\n创建一个新的 Conda 环境并激活它：\n```bash\nconda create -n env\nconda activate env\n```\n根据您的 CUDA 版本安装兼容的 PyTorch 版本 [这里](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Fprevious-versions\u002F)，例如以下命令适用于 CUDA 11.6：\n```bash\nconda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia\n```\n安装 `transformers` 和 `peft`：\n```bash\nconda install -c huggingface transformers \npip install git+https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft.git\n```\n请注意，您也可以通过以下方式安装最新稳定版的 Transformers：\n```bash\npip install git+https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\n```\n\n安装 `datasets`、`accelerate` 和 `huggingface_hub`：\n```bash\nconda install -c huggingface -c conda-forge datasets\nconda install -c conda-forge accelerate\nconda install -c conda-forge huggingface_hub\n```\n\n最后，安装 `bitsandbytes` 和 `wandb`：\n```bash\npip install bitsandbytes\npip install wandb\n```\n要获取所有参数及其说明的完整列表，您可以在任何脚本上运行以下命令：\n```\npython scripts\u002Fsome_script.py --help\n```\n在运行任何脚本之前，请确保您已登录并可以推送至 Hub：\n```bash\nhuggingface-cli login\n```\n同时确保您已登录 `wandb`：\n```bash\nwandb login\n```\n现在一切准备就绪，您可以克隆仓库并进入相应的目录。\n\n## 数据集\n💫 StarCoder 可以被微调以完成多种下游任务。我们目前的兴趣在于微调 StarCoder，使其能够遵循指令。[指令微调](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2109.01652.pdf) 近年来备受关注，因为它提供了一个简单的框架，教会语言模型将其输出与人类需求保持一致。这一过程需要高质量的指令数据集，其中包含多个“指令-答案”对。遗憾的是，这类数据集并不常见，但借助 Hugging Face 🤗 的 [datasets](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdatasets) 库，我们可以获得一些不错的替代数据集。为了经济高效地进行微调，我们使用 Hugging Face 🤗 的 [PEFT](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft) 以及 Tim Dettmers 的 [bitsandbytes](https:\u002F\u002Fgithub.com\u002FTimDettmers\u002Fbitsandbytes)。\n\n### Stack Exchange SE\n[Stack Exchange](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FStack_Exchange) 是一个知名的问答网站网络，涵盖多个领域的主题。用户可以在这里提问，并从其他用户那里获得答案。这些答案会根据其质量进行评分和排序。[Stack Exchange 指令数据集](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FArmelR\u002Fstack-exchange-instruction)是通过爬取该网站而得到的问答对集合。随后，可以使用该数据集对语言模型进行微调，以提升其强大且多样化的问答能力。\n\n要执行微调脚本，请运行以下命令：\n```bash\npython finetune\u002Ffinetune.py \\\n  --model_path=\"bigcode\u002Fstarcoder\"\\\n  --dataset_name=\"ArmelR\u002Fstack-exchange-instruction\"\\\n  --subset=\"data\u002Ffinetune\"\\\n  --split=\"train\"\\\n  --size_valid_set 10000\\\n  --streaming\\\n  --seq_length 2048\\\n  --max_steps 1000\\\n  --batch_size 1\\\n  --input_column_name=\"question\"\\\n  --output_column_name=\"response\"\\ \n  --gradient_accumulation_steps 16\\\n  --learning_rate 1e-4\\\n  --lr_scheduler_type=\"cosine\"\\\n  --num_warmup_steps 100\\\n  --weight_decay 0.05\\\n  --output_dir=\".\u002Fcheckpoints\" \\\n```\n使用流式处理时，SE 数据集的规模更容易管理。此外，还需要明确所使用的数据集划分。更多详细信息，请参阅 🤗 上的 [数据集页面](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FArmelR\u002Fstack-exchange-instruction)。同样地，我们也可以根据 GPU 的可用性调整命令：\n\n```bash\npython -m torch.distributed.launch \\\n  --nproc_per_node number_of_gpus finetune\u002Ffinetune.py \\\n  --model_path=\"bigcode\u002Fstarcoder\"\\\n  --dataset_name=\"ArmelR\u002Fstack-exchange-instruction\"\\\n  --subset=\"data\u002Ffinetune\"\\\n  --split=\"train\"\\\n  --size_valid_set 10000\\\n  --streaming \\\n  --seq_length 2048\\\n  --max_steps 1000\\\n  --batch_size 1\\\n  --input_column_name=\"question\"\\\n  --output_column_name=\"response\"\\ \n  --gradient_accumulation_steps 16\\\n  --learning_rate 1e-4\\\n  --lr_scheduler_type=\"cosine\"\\\n  --num_warmup_steps 100\\\n  --weight_decay 0.05\\\n  --output_dir=\".\u002Fcheckpoints\" \\\n```\n\n## 合并 PEFT 适配器层\n如果你使用 PEFT 训练了一个模型，想要进行推理或评估时，就需要将适配器层与基础模型合并。为此，运行以下命令：\n```bash\npython finetune\u002Fmerge_peft_adapters.py --base_model_name_or_path model_to_merge --peft_model_path model_checkpoint\n\n# 将合并后的模型推送到 Hugging Face Hub\npython finetune\u002Fmerge_peft_adapters.py --base_model_name_or_path model_to_merge --peft_model_path model_checkpoint --push_to_hub\n```\n\n例如：\n```bash\npython finetune\u002Fmerge_peft_adapters.py --model_name_or_path bigcode\u002Fstarcoder --peft_model_path checkpoints\u002Fcheckpoint-1000 --push_to_hub\n```\n\n# 评估\n为了评估 StarCoder 及其衍生模型，你可以使用 [BigCode-Evaluation-Harness](https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fbigcode-evaluation-harness) 来评估代码大语言模型。\n\n# 推理硬件要求\n在 FP32 精度下，该模型需要超过 60GB 的内存；而在 FP16 或 BF16 精度下，则只需约 30GB 内存；若采用 8 位量化，甚至可以在不到 20GB 的内存下运行。具体方法如下：\n```python\n# 确保已安装 accelerate 和 bitsandbytes\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ntokenizer = AutoTokenizer.from_pretrained(\"bigcode\u002Fstarcoder\")\n# 对于 FP16，将 `load_in_8bit=True` 替换为 `torch_dtype=torch.float16`\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode\u002Fstarcoder\", device_map=\"auto\", load_in_8bit=True)\nprint(f\"内存占用：{model.get_memory_footprint() \u002F 1e6:.2f} MB\")\n````\n```\n内存占用：15939.61 MB\n```\n你还可以尝试 [starcoder.cpp](https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fstarcoder.cpp)，这是一个基于 [ggml](https:\u002F\u002Fgithub.com\u002Fggerganov\u002Fggml) 库的 C++ 实现。","# StarCoder 快速上手指南\n\nStarCoder 是一个专为代码生成设计的开源大语言模型，支持超过 80 种编程语言。它基于 GitHub 代码、Issues、Commits 及 Notebook 数据训练而成，能够自动补全函数或生成代码片段。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**：Linux (推荐), macOS, Windows\n- **GPU**：NVIDIA GPU (推荐)，显存需求如下：\n  - FP32 精度：> 60GB\n  - FP16\u002FBF16 精度：约 30GB\n  - 8-bit 量化：\u003C 20GB\n- **Python**：3.8+\n- **CUDA**：根据 PyTorch 版本匹配（如 11.6+）\n\n### 前置依赖\n在使用模型前，必须完成以下两步：\n1. 访问 [Hugging Face StarCoder 页面](https:\u002F\u002Fhf.co\u002Fbigcode\u002Fstarcoder) 并同意使用协议。\n2. 在终端登录 Hugging Face Hub：\n```bash\nhuggingface-cli login\n```\n\n## 安装步骤\n\n### 方法一：基础安装 (推荐)\n直接安装项目所需的依赖库：\n```bash\npip install -r requirements.txt\n```\n*注：若 `requirements.txt` 不存在，请确保已安装 `transformers`, `accelerate`, `torch` 等核心库。*\n\n### 方法二：Conda 分步安装 (适用于微调或特定环境)\n如果你需要构建隔离环境或进行微调，建议使用 Conda：\n\n1. **创建并激活环境**\n```bash\nconda create -n starcoder-env python=3.9\nconda activate starcoder-env\n```\n\n2. **安装 PyTorch (以 CUDA 11.6 为例)**\n国内用户可使用清华源加速：\n```bash\nconda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia\n# 或使用清华镜像\n# conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia --index-url https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n3. **安装 Hugging Face 生态库**\n```bash\npip install transformers peft datasets accelerate huggingface_hub bitsandbytes wandb\n# 安装最新版 transformers (可选)\n# pip install git+https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\n```\n\n## 基本使用\n\n### 1. 代码生成 (Python 脚本)\n以下是最简单的代码补全示例。为了节省显存，建议加载时使用 `float16` 或 `load_in_8bit=True`。\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ncheckpoint = \"bigcode\u002Fstarcoder\"\ndevice = \"cuda\" # 若无 GPU 可改为 \"cpu\"\n\ntokenizer = AutoTokenizer.from_pretrained(checkpoint)\n\n# 加载模型：推荐使用 float16 或 8-bit 量化以降低显存占用\nmodel = AutoModelForCausalLM.from_pretrained(\n    checkpoint, \n    device_map=\"auto\", \n    torch_dtype=torch.float16, # 或者使用 load_in_8bit=True\n).to(device)\n\n# 输入提示词\ninputs = tokenizer.encode(\"def print_hello_world():\", return_tensors=\"pt\").to(device)\n\n# 生成代码\noutputs = model.generate(inputs)\n\n# 解码输出 (clean_up_tokenization_spaces=False 防止标点周围空格丢失)\nprint(tokenizer.decode(outputs[0], clean_up_tokenization_spaces=False))\n```\n\n### 2. 使用 Pipeline 简化调用\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\n\ncheckpoint = \"bigcode\u002Fstarcoder\"\n\nmodel = AutoModelForCausalLM.from_pretrained(checkpoint, torch_dtype=torch.float16, device_map=\"auto\")\ntokenizer = AutoTokenizer.from_pretrained(checkpoint)\n\npipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer, device=0)\nresult = pipe(\"def hello():\")\nprint(result)\n```\n\n### 3. 高性能推理 (Docker)\n如需部署服务，可使用 `text-generation-inference`：\n\n```bash\ndocker run -p 8080:80 -v $PWD\u002Fdata:\u002Fdata -e HUGGING_FACE_HUB_TOKEN=\u003CYOUR_BIGCODE_TOKEN> -d ghcr.io\u002Fhuggingface\u002Ftext-generation-inference:latest --model-id bigcode\u002Fstarcoder --max-total-tokens 8192\n```\n*请将 `\u003CYOUR_BIGCODE_TOKEN>` 替换为你的 Hugging Face Access Token。*","某初创团队的后端工程师正在紧急重构一个遗留的 Python 微服务项目，需要在两天内将大量过时的 API 接口迁移到新的异步框架中，同时补充缺失的单元测试。\n\n### 没有 starcoder 时\n- 面对数千行缺乏文档的旧代码，工程师必须逐行阅读逻辑才能手动编写新实现，耗时极长且容易遗漏边界条件。\n- 在切换不同编程语言（如从 Python 到 Go）编写配套服务时，需要频繁查阅语法文档，打断开发心流，导致上下文切换成本高昂。\n- 编写单元测试完全依靠人工构思覆盖场景，不仅效率低下，还常因思维盲区导致测试覆盖率不足，留下潜在 Bug。\n- 遇到复杂的 GitHub Issue 描述时，难以快速将其转化为具体的代码修复方案，沟通与实现之间存在巨大的时间鸿沟。\n\n### 使用 starcoder 后\n- 输入旧函数签名后，starcoder 能基于对 80 多种编程语言的学习，瞬间生成符合新异步框架规范的完整函数实现，大幅缩短重构周期。\n- 利用其跨语言训练优势，starcoder 能流畅地在多语言项目间切换，自动补全不同语言的样板代码，让开发者始终保持专注。\n- 针对现有业务逻辑，starcoder 能自动推断并生成涵盖正常路径与异常处理的单元测试用例，显著提升代码健壮性与测试覆盖率。\n- 直接将 GitHub Issue 的自然语言描述投喂给模型，starcoder 即可输出对应的修复代码片段，加速从问题发现到解决的闭环。\n\nstarcoder 通过将海量开源代码库的集体智慧转化为实时辅助能力，让开发者从繁琐的样板工作中解放出来，专注于核心架构创新。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbigcode-project_starcoder_637eb0ea.png","bigcode-project","BigCode Project","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fbigcode-project_205d9f4a.png","BigCode Project is an open scientific collaboration run by Hugging Face and ServiceNow Research, focused on open and responsible development of LLMs for code.",null,"contact@bigcode-project.org","BigCodeProject","https:\u002F\u002Fwww.bigcode-project.org\u002F","https:\u002F\u002Fgithub.com\u002Fbigcode-project",[83],{"name":84,"color":85,"percentage":86},"Python","#3572A5",100,7517,533,"2026-04-16T01:12:05","Apache-2.0","Linux","推理可选：支持 CPU 或 NVIDIA GPU (CUDA)。FP32 需显存>60GB，FP16\u002FBF16 需约 30GB，8-bit 量化需\u003C20GB。微调示例基于 CUDA 11.6。","FP32 模式需系统内存>60GB；FP16 模式需约 30GB；8-bit 量化模式需\u003C20GB。",{"notes":95,"python":96,"dependencies":97},"使用前需在 Hugging Face 页面接受协议并登录 (huggingface-cli login)。微调建议使用 conda 管理环境。支持通过 Docker 使用 text-generation-inference 部署。若使用 8-bit 加载需安装 bitsandbytes。模型文件较大，请确保存储空间充足。","未说明",[98,99,100,101,102,103,104,105],"torch","transformers","peft","datasets","accelerate","huggingface_hub","bitsandbytes","wandb",[35,14,45],"2026-03-27T02:49:30.150509","2026-04-17T08:23:12.432936",[110,115,120,125,130,134],{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},37236,"使用 DeepSpeed + LoRA 进行微调时遇到 RuntimeError，提示生成器对象中期望只有一个唯一元素，该如何解决？","这个问题通常与初始化顺序有关。如果使用的是 ZeRO-3，需要在加载模型之前先初始化 `TrainingArguments`。这会触发 `zero.init()`，从而允许将大型模型分散加载到不同的 GPU 上，避免显存溢出（OOM）并解决该错误。\n\n正确的代码顺序示例如下：\n```python\n# 1. 先定义 TrainingArguments，并指定 deepspeed 配置文件路径\ntraining_args = TrainingArguments(\n    deepspeed='path\u002Fto\u002Fdeepspeed_config.json',\n    ...\n)\n\n# 2. 加载 tokenizer 和模型\ntokenizer = AutoTokenizer.from_pretrained(...)\nmodel = AutoModelForCausalLM.from_pretrained(...)\n\n# 3. 创建 Trainer 并开始训练\ntrainer = Trainer(args=training_args, model=model, ...)\ntrainer.train()\n```\n请确保在 `TrainingArguments` 中添加了 `deepspeed` 参数指向你的配置文件。","https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fstarcoder\u002Fissues\u002F96",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},37237,"使用 LoRA 微调 StarCoder 后，模型推理时只生成 `\u003C|endoftext|>` 标记，不输出任何代码，原因是什么？","这通常是因为解码策略或提示词格式不正确。根据社区经验，要获得合理的代码生成结果，建议采取以下配置：\n1. **使用 Infilling（填充）模式**：StarCoder 在填充模式下表现更好，需在 Prompt 中加入 `\u003CFILL_HERE>` 标记。\n2. **调整温度参数**：不要将 `temperature` 设置为 0（贪婪解码），尝试设置为一个很小的值，如 `1e-2` (0.01)。\n3. **设置重复惩罚**：将 `repetition_penalty` 设置为 1。\n\n参考配置示例：\n```python\n# 关键参数设置\ntemperature = 1e-2  # 避免设为 0\nrepetition_penalty = 1\n# Prompt 中需包含 \u003CFILL_HERE> 以启用 infilling 模式\n```\n此外，如果是 8bit 微调，单张 A100 80G 通常足够；若使用多张较小显存显卡（如 T4），可能需要分布式微调以避免显存不足。","https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fstarcoder\u002Fissues\u002F82",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},37238,"在 HumanEval 测试中，使用 bfloat16\u002Ffloat16 精度和贪婪解码（greedy decoding）时，StarCoder 总是输出 `\u003C|endoftext|>` 或无效代码，如何复现论文中的高分？","默认的直接从左到右的自回归生成（autoaggressive generation）在不使用特殊标记时效果可能不佳。要复现高分（pass@1 ~0.35），请参考官方评估 harness 的配置或使用 Playground 的策略：\n\n**方法一：使用官方评估命令（推荐）**\n```bash\naccelerate launch main.py \\\n  --model bigcode\u002Fstarcoder \\\n  --max_length_generation 512 \\\n  --tasks humaneval \\\n  --n_samples 1 \\\n  --batch_size 1 \\\n  --temperature 0 \\\n  --do_sample False \\\n  --precision bf16 \\\n  --allow_code_execution\n```\n\n**方法二：手动调整生成参数**\n如果自行编写推理代码，需注意：\n1. **启用 Infilling**：Prompt 中必须包含 `\u003CFILL_HERE>` 标记。\n2. **温度设置**：虽然评估脚本用 temperature=0，但在某些手动实现中，设置 `temperature = 1e-2` 比严格的 0 更稳定。\n3. **重复惩罚**：设置 `repetition_penalty=1`。\n\n注意：Playground 默认使用 Infilling 模式，而简单的从左到右生成如果不加 `\u003CFILL_HERE>` 标记，效果会大打折扣。","https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fstarcoder\u002Fissues\u002F23",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},37239,"运行推理代码时遇到 `KeyError: 'gpt_bigcode'` 错误，即使已经下载了模型文件，这是什么原因？","该错误通常是因为 `transformers` 库版本过旧，无法识别 StarCoder 使用的 `gpt_bigcode` 模型架构。\n\n**解决方案：**\n请升级 `transformers` 库到最新版本。StarCoder 需要较新版本的 transformers 才能正确加载其配置和模型类。\n\n执行以下命令升级：\n```bash\npip install --upgrade transformers\n```\n或者安装特定的最低兼容版本（通常建议直接使用最新版）。\n此外，加载模型时请确保添加 `trust_remote_code=True` 参数：\n```python\nmodel = AutoModelForCausalLM.from_pretrained(\"bigcode\u002Fstarcoder\", trust_remote_code=True)\n```","https:\u002F\u002Fgithub.com\u002Fbigcode-project\u002Fstarcoder\u002Fissues\u002F5",{"id":131,"question_zh":132,"answer_zh":133,"source_url":119},37240,"LoRA 微调显存不足（OOM），使用 6 张 T4 (15GB) 总共 90GB 显存仍然失败，有什么建议？","虽然总显存看似足够，但单卡显存限制是瓶颈。对于 StarCoder 的 LoRA 微调：\n\n1. **推荐硬件**：如果使用 8bit 量化 + LoRA，单张 A100 80GB 通常可以成功运行。\n2. **多卡方案**：如果使用多张较小显存的显卡（如 6 张 T4），必须使用**分布式微调**（Distributed Finetuning），例如配合 DeepSpeed 或 Accelerate 将模型分片到不同 GPU 上，而不能简单地将数据并行堆叠。\n3. **检查配置**：确保启动了 DeepSpeed ZeRO 优化（如 ZeRO-3），以便将模型参数、梯度和优化器状态分片存储。\n\n如果无法使用分布式训练，建议减少 `batch_size`、缩短 `seq_length` 或进一步降低精度（如使用 nf4）。",{"id":135,"question_zh":136,"answer_zh":137,"source_url":124},37241,"StarCoder 在 HumanEval 上的自回归生成（AR）效果不如 Infilling 模式，这是正常的吗？","是的，这是正常现象。StarCoder 在 Infilling（代码填充）任务上进行了专门优化，其表现通常优于纯粹的从左到右自回归生成（Auto-regressive generation）。\n\n在许多实际测试中（如 SantaCoder 和 StarCoder），如果仅使用标准的自回归模式而不使用 `\u003CFILL_HERE>` 标记触发 Infilling 机制，生成的代码质量会显著下降，甚至只输出结束标记。\n\n**建议：**\n在进行代码生成任务时，尽量构造包含 `\u003CFILL_HERE>` 的 Prompt 以利用模型的 Infilling 能力，而不是单纯依赖左到右的续写模式。",[]]