[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-keyvank--femtoGPT":3,"tool-keyvank--femtoGPT":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 真正成长为懂上",159267,2,"2026-04-17T11:29:14",[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":68,"readme_en":69,"readme_zh":70,"quickstart_zh":71,"use_case_zh":72,"hero_image_url":73,"owner_login":74,"owner_name":75,"owner_avatar_url":76,"owner_bio":77,"owner_company":78,"owner_location":79,"owner_email":80,"owner_twitter":81,"owner_website":82,"owner_url":83,"languages":84,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":93,"env_os":94,"env_gpu":95,"env_ram":96,"env_deps":97,"category_tags":107,"github_topics":108,"view_count":32,"oss_zip_url":81,"oss_zip_packed_at":81,"status":17,"created_at":118,"updated_at":119,"faqs":120,"releases":151},8573,"keyvank\u002FfemtoGPT","femtoGPT","Pure Rust implementation of a minimal Generative Pretrained Transformer","femtoGPT 是一个完全使用 Rust 语言从零构建的微型生成式预训练变压器（GPT）模型实现。它旨在剥离复杂的框架依赖，让开发者能够深入理解大型语言模型（LLM）底层的运作机制，涵盖了从张量处理逻辑到训练与推理代码的全流程自研。\n\n该项目主要解决了学习 LLM 内部原理时“黑盒化”的痛点。通过极简的代码结构，它直观地展示了 GPT 架构的核心细节，其设计与 Andrej Karpathy 著名的 nanoGPT 教程高度一致。femtoGPT 不仅支持 CPU 运行，还基于 OpenCL 实现了 GPU 加速，这意味着无需安装沉重的 CUDA 工具包，即可在 NVIDIA 或 AMD 显卡上进行训练和推理，极大地降低了硬件门槛。\n\n由于核心算法（如矩阵乘法）采用最基础的方式实现以保证可读性，femtoGPT 的运行速度相对较慢，生成的文本质量也处于早期探索阶段，但这正是其作为教学工具的价值所在。它非常适合对人工智能充满好奇的开发者、希望深入钻研模型底层的研究人员以及 Rust 语言爱好者。如果你不满足于调用现成的 API，而是想亲手拆解并理解大模型是如何“思考”的，femtoGP","femtoGPT 是一个完全使用 Rust 语言从零构建的微型生成式预训练变压器（GPT）模型实现。它旨在剥离复杂的框架依赖，让开发者能够深入理解大型语言模型（LLM）底层的运作机制，涵盖了从张量处理逻辑到训练与推理代码的全流程自研。\n\n该项目主要解决了学习 LLM 内部原理时“黑盒化”的痛点。通过极简的代码结构，它直观地展示了 GPT 架构的核心细节，其设计与 Andrej Karpathy 著名的 nanoGPT 教程高度一致。femtoGPT 不仅支持 CPU 运行，还基于 OpenCL 实现了 GPU 加速，这意味着无需安装沉重的 CUDA 工具包，即可在 NVIDIA 或 AMD 显卡上进行训练和推理，极大地降低了硬件门槛。\n\n由于核心算法（如矩阵乘法）采用最基础的方式实现以保证可读性，femtoGPT 的运行速度相对较慢，生成的文本质量也处于早期探索阶段，但这正是其作为教学工具的价值所在。它非常适合对人工智能充满好奇的开发者、希望深入钻研模型底层的研究人员以及 Rust 语言爱好者。如果你不满足于调用现成的 API，而是想亲手拆解并理解大模型是如何“思考”的，femtoGPT 将是一个极佳的学习起点。","# :robot: femtoGPT\n\n![crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Ffemto-gpt.svg)\n![GitHub top language](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flanguages\u002Ftop\u002Fkeyvank\u002FfemtoGPT)\n![GitHub](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fkeyvank\u002FfemtoGPT)\n\nfemtoGPT is a pure Rust implementation of a minimal Generative Pretrained Transformer.\n\nIt can be used for both *inference* and *training* of GPT-style language-models\nusing **CPUs** and **GPUs**!\n\n(***HEY!*** I'm also writing a book, which will soon discuss the implementation of a LLM in detail! Check it out here: [The Super Programmer](https:\u002F\u002Fgithub.com\u002Fkeyvank\u002Ftsp))\n\n## Usage\n\nTraining:\n\n`cargo run --release -- train`\n\nInference:\n\n`cargo run --release -- infer`\n\n(Note: Add `--features gpu` in order to leverage GPU speedups!)\n\n## Intro\n\nEverything is implemented from scratch, including the tensor processing logic\nalong with training\u002Finference code of a minimal GPT architecture.\n\nThe architecture is very similar\u002Falmost identical with Andrej Karpathy's\n[nanoGPT video lecture](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fng-video-lecture).\n\nfemtoGPT is a great start for those who are fascinated by LLMs and would like to\nunderstand how these models work in very deep levels.\n\nfemtoGPT uses nothing but random generation libraries (`rand`\u002F`rand-distr`), data-serialization\nlibraries (`serde`\u002F`bincode` for saving\u002Floading already trained models) and a\nparallel computing library (`rayon`).\n\nfemtoGPT is ~~EXTREMELY SLOW~~ ***relatively fast on CPU 😉***, and most of the\nprimitive operations (E.g Matrix multiplication) are implemented in the simplest way possible.\n\nCorrectness of gradients is checked using gradient-check method, though it still is very\npossible that some layers are implemented wrongly.\n\n([Discord server](https:\u002F\u002Fdiscord.gg\u002FwTJFaDVn45) for discussions around the project!)\n\n## Usage\n\nMake sure you have the Rust toolchain on your system, in order to compile and run\nthe project:\n\n`curl --proto '=https' --tlsv1.2 -sSf https:\u002F\u002Fsh.rustup.rs | sh`\n\nIf you want to train using a GPU, you will first need to make sure your GPU drivers\nare correctly installed on your system, and their OpenCL runtimes are available.\n\nOn Debian systems, you can setup OpenCL runtimes by installing the package `ocl-icd-opencl-dev`:\n\n`sudo apt install ocl-icd-opencl-dev`\n\n***GOOD NEWS!*** *Since femtoGPT's GPU implementation is based on OpenCL, it can\nrun on both NVIDIA and AMD cards, and you won't need to install heavy-weight\nCUDA-toolkits on your system. OpenCL runtimes would suffice!*\n\nNow you'll just need to put the text you want to train your GPT model on, inside\n`dataset.txt`. Make sure it has a small number of unique characters! (E.g. the\ncurrent dataset has only used 65 different unique characters!)\n\nThen you'll need to run:\n\n```\ncargo run --release\n```\n\nIt will start training the model and will put the training data in the `train_data`\ndirectory. You can stop the training and continue later!\n\n## Output samples\n\nAfter hours of training on the Shakespeare database, on a 300k parameter model,\nthis has been the output:\n\n```\nLIS:\nTore hend shater sorerds tougeng an herdofed seng he borind,\nOund ourere sthe, a sou so tousthe ashtherd, m se a man stousshan here hat mend serthe fo witownderstesther s ars at atheno sel theas,\nthisth t are sorind bour win soutinds mater horengher\n```\n\nThis is embarrassingly bad, but looking at the bright side, it seems like it has\nbeen able to generate words that are easy to pronounce.\n\nI'm currently training a 10M parameter model to further examine the correctness\nof my implementation.\n\n**UPDATE 5th June 2023:**\n\nThis has been a new output, after more hours of training on a model with similar scale:\n\n```\nWhat like but wore pad wo me che nogns yous dares,\nAs supt it nind bupart 'the reed:\nAnd hils not es\n```\n\nObviously the model has started to learn some words and punctuation rules!\n\n**UPDATE 9th June 2023:**\n\nModel was able to reach loss value of ~1.4\n\nHere is an example output:\n\n```\nAdistition gone; true; schistoes for mine souls!\nBefore your home, bariechts should be\nCarlam on that's a worf quirer of him so.\nWhat look'd lack away more\nTo him foot; one hour fortious of saves:\nSon;\n'Tis all Earl mmistling me.\n\nHARSARTIO:\nWhy, idless of my mocks fan that were percious.\nHaving I will thou should and the muour ne'er shor\nTo purple, when duke thy are out him.\nBut will bid you doth remember nature.\nEven OF hencomey, carniffeit, I joy\nWarming; my deed, but it on of mortard,\n```\n\n**UPDATE 10th June 2023, sparks of AGI? LOL**\n\nHaving trained a 5-layer model on a dataset gathered from Reddit, tokenized with sentencepiece tokenizer with a vocab-size of 500, for about ~10 hours on a 32-core CPU:\n\nPrompt **\"I think\"**:\n\n```\nI think it s not a scientific method of atheism\nI think it s not a fairly simple possible to have a\nI think that s a possible point, but I m not sure if you re not\nI think that s a great idea, but I m not sure how these are you talking\nI think it s a simple thing to do, but I m not sure how thes\nI think that s a good thing, but I don t think that s what I mean, I think I\nI think that s the only way to be able to use it to be in the same way, but\nI think that the police are relatively relatively relative\nI think that s a simple moron is a simple character\nI think that s the only way to go to the second side of the pol\n```\n\nPrompt **\"Life is\"**:\n\n```\nLife is not a good idea, but it s not a perfection of the opp\nLife is a good thing to say that I don t know what you re talking about, but I don\nLife is not the same as a religion, but I m not sure if you re a\nLife is a perfectly good job of arguing that you are alm\nLife is a perfectly good job of the opposite of the f\nLife is a fundamentalist, and then I m not sure how the h\nLife is not a good idea, and it s not a perfectly good job, but I\nLife is not the same as atheists, but that s the only way to be ac\nLife is a bit of a single one of these industry is a f\nLife is a good idea to get the opposite of the police offic\n```\n\nPrompt **\"So sad that\"**:\n\n```\nSo sad that you can tell you what? I think I ve been using it on the scre\nSo sad that I don t know about it, but I don t think I m not afraid to\nSo sad that I m not sure if you re not arguing with the fact that you\nSo sad that I was involved in the future, and I have a few we\nSo sad that s what I said, I m sure you are almost everything you\nSo sad that you can do it, and I don t think that the fact that it s a po\nSo sad that I m not sure if you re arguing with the fact that they are\nSo sad that s the one too much time, but I m not sure if you re arg\nSo sad that you are sadly supposed to be a big deal in the world\nSo sad that I don t know about this, but I m not sure how you can do it, but\n```\n\n**UPDATE 29th June 2023**\n\nAfter the implementation of the GPU trainer, we were able to train larger models. \nHere are some samples from a 8-layer 8-head 128-embedding-degree model, trained on\nTinyStories dataset on a vocab-size of 1000:\n\n```\nOnce upon a time, there was a little girl named Lily.\nShe loved to play with her toys and she had a lot of fun.\nOne day, Lily saw a big chicky playing with her toys.\nShe asked her mom, \"Can I play with her toys?\" Her mom said,\n\"Sure, Lily. But we have to clean the pales. Let's suet some candy, Lily.\"\nLily nodded and went to her mom. They played with the mots and staugning her toys.  \n```\n\n```\nOnce upon a time, there was a little girl named Lily.\nShe loved to play outside and explore. One day, she found a jung on the ground.\nShe picked it up and tecked it. She ran around and saw it. She was very sad.\nShe asked her mom for her mom. Her mom said, \"Lily, I'm going to find it!\" Lily said.\nShe ran to the slock and took her to the teplace. She went to the park and found a molla.\n```\n\n```\nThere was a boy named Tim. Tim loved to play with his toys.\nOne day, Tim's mom came to the park. Tim saw a big, red ball and wanted to play with it.\nTim wanted to play with the ball. Tim was very excited. He wanted to play with the ball.\nBut the ball was too fast. Tim wanted to play with the ball. But the ball was too fast.\nTim tried to catch it, but it was too fast. Tim was sad. He tried to run away,\nbut he did not want to play. Tim was sad. He did not want to play with the ball.\n```\n","# :robot: femtoGPT\n\n![crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Ffemto-gpt.svg)\n![GitHub 语言占比](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flanguages\u002Ftop\u002Fkeyvank\u002FfemtoGPT)\n![GitHub 许可证](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fkeyvank\u002FfemtoGPT)\n\nfemtoGPT 是一个纯 Rust 实现的极简生成式预训练 Transformer 模型。\n\n它既可以用于 GPT 风格语言模型的 *推理*，也可以用于 *训练*，\n支持在 **CPU** 和 **GPU** 上运行！\n\n(***嘿！*** 我还在写一本书，很快就会详细讨论 LLM 的实现！请看这里：[The Super Programmer](https:\u002F\u002Fgithub.com\u002Fkeyvank\u002Ftsp))\n\n## 使用方法\n\n训练：\n\n`cargo run --release -- train`\n\n推理：\n\n`cargo run --release -- infer`\n\n（注意：添加 `--features gpu` 可以利用 GPU 加速！）\n\n## 简介\n\n一切代码均从零开始编写，包括张量处理逻辑以及极简 GPT 架构的训练和推理代码。\n\n该架构与 Andrej Karpathy 的 *nanoGPT 视频讲座* 中的内容非常相似，几乎完全一致。\n（链接：[karpathy\u002Fng-video-lecture](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fng-video-lecture)）\n\n对于那些对大型语言模型充满兴趣、希望深入理解其工作原理的人来说，femtoGPT 是一个绝佳的起点。\n\nfemtoGPT 仅依赖于随机数生成库（`rand`\u002F`rand-distr`）、数据序列化库（`serde`\u002F`bincode`，用于保存和加载已训练好的模型）以及并行计算库（`rayon`）。\n\nfemtoGPT 虽然 ~~极其缓慢~~ ***但在 CPU 上相对还算快速 😉***，大多数基础操作（例如矩阵乘法）都以最简单的方式实现。\n\n我们使用梯度检查方法来验证梯度的正确性，不过仍然有可能某些层的实现存在错误。\n\n（关于该项目的讨论可在 [Discord 服务器](https:\u002F\u002Fdiscord.gg\u002FwTJFaDVn45) 中进行！）\n\n## 使用说明\n\n请确保您的系统上已安装 Rust 工具链，以便编译和运行该项目：\n\n`curl --proto '=https' --tlsv1.2 -sSf https:\u002F\u002Fsh.rustup.rs | sh`\n\n如果您想使用 GPU 进行训练，首先需要确认您的 GPU 驱动程序已正确安装，并且 OpenCL 运行时环境可用。\n\n在 Debian 系统上，可以通过安装 `ocl-icd-opencl-dev` 包来设置 OpenCL 运行时环境：\n\n`sudo apt install ocl-icd-opencl-dev`\n\n***好消息！*** *由于 femtoGPT 的 GPU 实现基于 OpenCL，因此它可以在 NVIDIA 和 AMD 显卡上运行，而无需在系统上安装重量级的 CUDA 工具包。只需配置好 OpenCL 运行时环境即可！*\n\n接下来，您只需将想要用来训练 GPT 模型的文本放入 `dataset.txt` 文件中。请确保文件中的唯一字符数量较少！（例如，当前的数据集仅使用了 65 个不同的字符！）\n\n然后运行以下命令：\n\n```\ncargo run --release\n```\n\n程序将开始训练模型，并将训练数据保存到 `train_data` 目录中。您可以随时停止训练，并在之后继续进行！\n\n## 输出示例\n\n在莎士比亚语料库上对一个30万参数的模型进行了数小时的训练后，得到了如下输出：\n\n```\nLIS:\nTore hend shater sorerds tougeng an herdofed seng he borind,\nOund ourere sthe, a sou so tousthe ashtherd, m se a man stousshan here hat mend serthe fo witownderstesther s ars at atheno sel theas,\nthisth t are sorind bour win soutinds mater horengher\n```\n\n这段文字糟糕得令人尴尬，但从积极的一面来看，它似乎能够生成一些容易发音的词语。\n\n目前，我正在训练一个1000万参数的模型，以进一步检验我的实现是否正确。\n\n**2023年6月5日更新：**\n\n在对规模相近的模型继续训练了更多时间后，又出现了新的输出：\n\n```\nWhat like but wore pad wo me che nogns yous dares,\nAs supt it nind bupart 'the reed:\nAnd hils not es\n```\n\n显然，模型已经开始学习一些单词和标点符号的使用规则了！\n\n**2023年6月9日更新：**\n\n模型的损失值已经降至约1.4。\n\n以下是一个示例输出：\n\n```\nAdistition gone; true; schistoes for mine souls!\nBefore your home, bariechts should be\nCarlam on that's a worf quirer of him so.\nWhat look'd lack away more\nTo him foot; one hour fortious of saves:\nSon;\n'Tis all Earl mmistling me.\n\nHARSARTIO:\nWhy, idless of my mocks fan that were percious.\nHaving I will thou should and the muour ne'er shor\nTo purple, when duke thy are out him.\nBut will bid you doth remember nature.\nEven OF hencomey, carniffeit, I joy\nWarming; my deed, but it on of mortard,\n```\n\n**2023年6月10日更新：AGI的火花？哈哈**\n\n我在一台32核CPU上，用从Reddit收集的数据集训练了一个5层模型，该数据集经过SentencePiece分词器处理，词汇表大小为500，训练时间约为10小时。\n\n提示词 **“我认为”**：\n\n```\n我认为这并不是一种科学的无神论方法。\n我认为这并不是一件非常简单的事情。\n我认为那是一个可能的观点，但我并不确定你是否……\n我认为那是个好主意，但我并不清楚你们在讨论什么。\n我认为那是一件简单的事，但我并不明白这些……\n我认为那是一件好事，但我并不认为这就是我的意思，我想……\n我认为那是唯一能够以同样方式使用它的方法，但……\n我认为警察相对来说比较……\n我认为那只是一个简单的傻瓜角色。\n我认为那是通往第二面的唯一途径……\n```\n\n提示词 **“生活是”**：\n\n```\n生活并不是一个好主意，但它也不是完美的对立面。\n生活是一件好事，可以说我不知道你在说什么，但我……\n生活并不等同于宗教，但我并不确定你是否……\n生活是一份完美合理的论证，说明你其实……\n生活是一份完美合理的反对意见，关于……\n生活是一种根本主义，然后我不确定如何……\n生活并不是一个好主意，而且也不是一份完美的工作，但我……\n生活并不等同于无神论者，但那是成为……的唯一途径。\n生活有点像这个行业中的单一因素……\n生活是一个很好的主意，可以用来对抗警察办公室……\n```\n\n提示词 **“真遗憾的是”**：\n\n```\n真遗憾的是，你能告诉我这是什么吗？我想我已经在屏幕上使用过它了。\n真遗憾的是，我对这件事一无所知，但我并不觉得害怕……\n真遗憾的是，我不确定你是否在争论……的事实。\n真遗憾的是，我曾经参与过未来的事情，而我们有一些……\n真遗憾的是，这就是我说过的，我相信你几乎了解所有……\n真遗憾的是，你可以做到这一点，但我并不认为……的事实。\n真遗憾的是，我不确定你是否在争论他们……的事实。\n真遗憾的是，那只是太多的时间了，但我并不确定你是否在争……\n真遗憾的是，你本应在这个世界上成为一个大事件……\n真遗憾的是，我对这件事并不了解，但我并不确定你如何能做到，但……\n```\n\n**2023年6月29日更新**\n\n在实现了GPU训练器之后，我们得以训练更大规模的模型。以下是用TinyStories数据集、1000个词汇表大小，在一个8层、8头、嵌入维度为128的模型上训练得到的一些样本：\n\n```\n从前，有一个叫莉莉的小女孩。\n她喜欢玩自己的玩具，玩得非常开心。\n有一天，莉莉看到一只大鸡仔正在玩她的玩具。\n她问妈妈：“我可以和她一起玩玩具吗？”妈妈回答说：\n“当然可以，莉莉。不过我们得先把玩具收拾干净。来，莉莉，我们先吃点糖果吧。”\n莉莉点点头，跟着妈妈去了。她们一起玩着玩具，度过了愉快的时光。\n```\n\n```\n从前，有一个叫莉莉的小女孩。\n她喜欢到外面玩耍和探索。有一天，她在地上发现了一片叶子。\n她捡起来看了看，跑来跑去地观察它，心里却很难过。\n她向妈妈求助。妈妈说：“莉莉，我这就去找找看！”莉莉听了很高兴。\n她跑到树林里，把叶子带回了家。后来她们去了公园，找到了一朵花。\n```\n\n```\n有一个叫蒂姆的小男孩。蒂姆很喜欢玩自己的玩具。\n有一天，蒂姆的妈妈带他去了公园。蒂姆看见一个又大又红的球，很想玩。\n蒂姆非常兴奋，想要玩那个球。可是球滚得太快了，蒂姆追不上。\n他试着去抓，但球总是溜走。蒂姆很伤心，他试图逃跑，\n可他还是忍不住想玩那个球。蒂姆最终还是没能玩成那个球。\n```","# femtoGPT 快速上手指南\n\nfemtoGPT 是一个纯 Rust 实现的极简生成式预训练变压器（GPT）模型。它完全从零构建，包含张量处理逻辑及训练\u002F推理代码，适合希望深入理解大语言模型（LLM）底层原理的开发者。支持 CPU 和 GPU（基于 OpenCL）加速。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**：Linux, macOS, Windows (需配置 Rust 环境)\n- **硬件**：\n  - **CPU**：任意多核处理器（使用 `rayon` 并行库加速）。\n  - **GPU（可选）**：支持 OpenCL 的 NVIDIA 或 AMD 显卡。**无需安装沉重的 CUDA 工具包**，只需 OpenCL 运行时。\n\n### 前置依赖\n1. **Rust 工具链**\n   确保已安装 Rust。国内用户推荐使用官方安装脚本（若网络受限，可配置国内镜像源或使用 `rustup` 镜像）：\n   ```bash\n   curl --proto '=https' --tlsv1.2 -sSf https:\u002F\u002Fsh.rustup.rs | sh\n   ```\n   *安装完成后，重启终端或运行 `source $HOME\u002F.cargo\u002Fenv` 使环境变量生效。*\n\n2. **GPU 驱动与 OpenCL（仅当需要使用 GPU 加速时）**\n   - 确保显卡驱动已正确安装。\n   - **Debian\u002FUbuntu 系统**：安装 OpenCL 运行时开发包。\n     ```bash\n     sudo apt install ocl-icd-opencl-dev\n     ```\n   - 其他发行版请安装对应的 `opencl-headers` 和 `ocl-icd` 相关包。\n\n## 安装步骤\n\n克隆项目并进入目录（假设已获取源码）：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT.git\ncd femtoGPT\n```\n\n由于是 Rust 项目，无需传统“安装”过程，直接通过 `cargo` 编译运行即可。建议始终使用 `--release` 模式以获得最佳性能。\n\n## 基本使用\n\n### 1. 准备数据集\n将用于训练的文本内容保存为项目根目录下的 `dataset.txt` 文件。\n> **提示**：为了快速验证，建议使用字符集较小的文本（如莎士比亚文集或简单的故事集），唯一字符数量越少，模型收敛越快。\n\n### 2. 开始训练\n运行以下命令启动训练过程。训练数据将保存在 `train_data` 目录中，支持中断后继续训练。\n\n**仅使用 CPU：**\n```bash\ncargo run --release\n```\n\n**使用 GPU 加速：**\n需添加 `gpu` 特性标志：\n```bash\ncargo run --release --features gpu\n```\n\n### 3. 模型推理\n训练完成后（或加载已有模型），运行以下命令进行文本生成测试：\n\n**仅使用 CPU：**\n```bash\ncargo run --release -- infer\n```\n\n**使用 GPU 加速：**\n```bash\ncargo run --release --features gpu -- infer\n```\n\n运行后，程序将基于训练好的模型生成文本样本。随着训练时长增加，生成内容的连贯性和语法正确性将显著提升。","一位高校计算机专业的研究生正在准备关于大语言模型（LLM）底层原理的毕业设计，他需要从零构建一个微型 GPT 模型以验证梯度反向传播的正确性，但受限于实验室仅有普通 CPU 和老旧 AMD 显卡的硬件环境。\n\n### 没有 femtoGPT 时\n- **环境配置极其繁琐**：若要利用 GPU 加速，必须安装庞大的 CUDA  toolkit，且无法兼容实验室现有的 AMD 显卡，导致只能被迫使用纯 CPU 跑实验，训练速度慢到难以接受。\n- **代码复现门槛高**：参考 Andrej Karpathy 的 nanoGPT 教程需要依赖 PyTorch 等重型框架，底层张量运算被封装，难以深入理解矩阵乘法等原始操作的具体实现细节。\n- **调试与验证困难**：自行从头编写 Rust 或 C++ 实现时，缺乏内置的梯度检查（gradient-check）机制，很难判断是模型架构设计错误还是代码逻辑漏洞，排查耗时极长。\n- **资源占用过大**：主流深度学习框架动辄占用数 GB 显存和内存，在低配机器上运行微小参数模型也显得臃肿不堪，无法灵活调整实验规模。\n\n### 使用 femtoGPT 后\n- **跨平台 GPU 加速即开即用**：femtoGPT 基于 OpenCL 实现，无需安装沉重的 CUDA，直接通过 `--features gpu` 参数即可同时调用 NVIDIA 和 AMD 显卡，显著提升了训练效率。\n- **纯净源码助力深度研习**：作为纯 Rust 实现的极简版本，femtoGPT 去除了所有黑盒依赖，让研究者能逐行阅读从张量处理到训练推理的完整逻辑，真正吃透 LLM 架构。\n- **内置正确性验证机制**：工具自带梯度检查方法，能快速确认反向传播实现的准确性，让研究者将精力集中在算法优化而非基础除错上。\n- **轻量级部署灵活可控**：仅依赖少量基础库（如 rand、rayon），femtoGPT 在低配设备上也能流畅运行，支持随时中断并恢复训练，完美适配碎片化的实验时间。\n\nfemtoGPT 通过极简的纯 Rust 架构和广泛的硬件兼容性，将大模型的学习与实验门槛从“工程调包”降低到了“原理透彻”的级别。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fkeyvank_femtoGPT_d501cbc9.png","keyvank","Keyvan Kambakhsh","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fkeyvank_2d2dce93.png","- You want to ask, so ask.\r\n+ Are you real?\r\n- Well, if you can't tell, does it matter?","@worm-privacy","Internet","keyvankambakhsh@gmail.com",null,"http:\u002F\u002Fkeyvan.me","https:\u002F\u002Fgithub.com\u002Fkeyvank",[85],{"name":86,"color":87,"percentage":88},"Rust","#dea584",100,936,67,"2026-04-08T13:46:00","MIT",4,"Linux, macOS, Windows","非必需。若使用 GPU，需支持 OpenCL 的显卡（兼容 NVIDIA 和 AMD），无需 CUDA。Debian 系统需安装 ocl-icd-opencl-dev。","未说明",{"notes":98,"python":99,"dependencies":100},"该项目是纯 Rust 实现，不依赖 Python。编译前需安装 Rust 工具链。GPU 加速基于 OpenCL 而非 CUDA，因此避免了安装重型 CUDA 工具包的需求。训练数据需放置在 dataset.txt 文件中，且建议字符集较小。","不需要 (基于 Rust)",[101,102,103,104,105,106],"Rust toolchain","rand","rand-distr","serde","bincode","rayon",[35,14,13],[109,110,111,112,113,114,115,116,117],"gpt","machine-learning","neural-network","llm","from-scratch","rust","gpu","opencl","hacktoberfest","2026-03-27T02:49:30.150509","2026-04-18T02:20:44.480813",[121,126,131,136,141,146],{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},38408,"如何增加模型的参数量？","可以通过以下方式增加参数量：1. 增加网络层数（layers）；2. 增加嵌入维度（embedding-degree），此时也需要相应调整头大小（head_size）。参考 Andrej Karpathy 视频中的 10M 参数配置：6 层、嵌入维度 384、6 个头、256 个 token。","https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT\u002Fissues\u002F1",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},38409,"如何让模型续写用户提供的文本而不是从头生成？","需要在推理（infer）方法中填充上下文向量（context vector）。通过传入用户提供的文本作为初始上下文，模型即可基于此进行续写生成。","https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT\u002Fissues\u002F3",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},38410,"训练过程中损失值（loss）出现抖动是否正常？","这是正常现象。请确保使用了最新的优化代码并继续训练。当损失值降至 2.0 左右时，模型效果会开始显著提升。即使损失值在 2.48 到 2.72 之间波动，也建议持续运行训练几天以观察收敛情况。","https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT\u002Fissues\u002F6",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},38411,"是否支持 GPU 训练？支持哪些显卡？","项目已支持 GPU 训练。底层使用 OpenCL 基础设施，因此同时支持 AMD 和 Nvidia 显卡。","https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT\u002Fissues\u002F13",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},38412,"位置编码（Positional Encoding）对模型有什么影响？","添加正弦\u002F余弦位置编码可以减少参数量并加快模型速度。虽然不加位置编码模型也能学习，但加上后句子语义更通顺，且损失收敛更快（例如使用 SentencePiece 时，损失能顺利降至 2.0 以下，而不加时可能卡在 2.0）。","https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT\u002Fissues\u002F16",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},38413,"运行时遇到 `Option::unwrap()` on a `None` value 恐慌错误怎么办？","该错误通常发生在分词器处理数据时（如 src\u002Ftokenizer\u002Fsimple.rs）。常见原因是数据集格式问题，尝试调整数据集，例如增加更多的换行符或断行，确保分词器能正确解析所有字符。","https:\u002F\u002Fgithub.com\u002Fkeyvank\u002FfemtoGPT\u002Fissues\u002F23",[]]