[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tool-meta-pytorch--gpt-fast":3,"similar-meta-pytorch--gpt-fast":82},{"id":4,"github_repo":5,"name":6,"description_en":7,"description_zh":8,"ai_summary_zh":8,"readme_en":9,"readme_zh":10,"quickstart_zh":11,"use_case_zh":12,"hero_image_url":13,"owner_login":14,"owner_name":15,"owner_avatar_url":16,"owner_bio":17,"owner_company":18,"owner_location":18,"owner_email":18,"owner_twitter":18,"owner_website":19,"owner_url":20,"languages":21,"stars":30,"forks":31,"last_commit_at":32,"license":33,"difficulty_score":34,"env_os":35,"env_gpu":36,"env_ram":37,"env_deps":38,"category_tags":44,"github_topics":18,"view_count":47,"oss_zip_url":18,"oss_zip_packed_at":18,"status":48,"created_at":49,"updated_at":50,"faqs":51,"releases":81},3384,"meta-pytorch\u002Fgpt-fast","gpt-fast","Simple and efficient pytorch-native transformer text generation in \u003C1000 LOC of python.","gpt-fast 是一个基于原生 PyTorch 构建的轻量级文本生成项目，旨在用不到 1000 行 Python 代码实现高效的大语言模型推理。它并非一个复杂的框架或库，而是一套极简的代码示例，展示了如何在不依赖额外重型组件的前提下，挖掘 PyTorch 本身的性能潜力。\n\n该项目主要解决了大模型本地部署中延迟高、依赖复杂及资源占用大的痛点。通过引入 int8\u002Fint4 量化、推测性解码（Speculative Decoding）以及张量并行等技术，gpt-fast 能在单用户场景下显著降低生成延迟，提升每秒令牌输出速度，同时支持 NVIDIA 和 AMD 等多种 GPU 硬件。\n\ngpt-fast 特别适合开发者、研究人员以及对底层技术感兴趣的技术爱好者使用。如果你希望深入理解 Transformer 模型的推理优化机制，或者需要在资源受限的环境中快速验证模型性能，这套代码提供了极佳的参考范本。目前，它已支持 LLaMA 系列、Mixtral 8x7B 等多种主流开源模型，并鼓励用户直接复制、修改或扩展代码以适应特定需求，是学习高性能 AI 工程化的理想起点。","# gpt-fast\nSimple and efficient pytorch-native transformer text generation.\n\nFeaturing:\n1. Very low latency\n2. \u003C1000 lines of python\n3. No dependencies other than PyTorch and sentencepiece\n4. int8\u002Fint4 quantization\n5. Speculative decoding\n6. Tensor parallelism\n7. Supports Nvidia and AMD GPUs\n\nThis is *NOT* intended to be a \"framework\" or \"library\" - it is intended to show off what kind of performance you can get with native PyTorch :) Please copy-paste and fork as you desire.\n\nFor an in-depth walkthrough of what's in this codebase, see this [blog post](https:\u002F\u002Fpytorch.org\u002Fblog\u002Faccelerating-generative-ai-2\u002F).\n\n## Supported Models\n\n### LLaMA family\nPlease check the rest of this page about benchmark of LLaMA family models.\n\n### Mixtral 8x7B\nWe also supported [Mixtral 8x7B](https:\u002F\u002Fmistral.ai\u002Fnews\u002Fmixtral-of-experts\u002F) which is a high-quality sparse mixture of experts (MoE) model, the average token generation rates are:\n\n|                  |   1 GPU |    2 GPU  | 4 GPU  |    8 GPU   |\n|------------------|---------|-----------|--------|------------|\n|baseline(bfloat16)|    OOM  |    96.67  | 155.35 |  227.82    |\n|        int8      |   97.92 |   155.03  | 216.87 |  279.35    |\n\nNote that the benchmarks run on an 8xA100-80GB, power limited to 330W with a hybrid cube mesh topology. Note that all benchmarks are run at *batch size=1*, making the reported tokens\u002Fs numbers equivalent to \"tokens\u002Fs\u002Fuser\". In addition, they are run with a very small prompt length (just 5 tokens).\n\nFor more details about Mixtral 8x7B, please check [this page](.\u002Fmixtral-moe) or this [note](https:\u002F\u002Fthonking.substack.com\u002Fp\u002Fshort-supporting-mixtral-in-gpt-fast).\n\n## Examples\nIn the spirit of keeping the repo minimal, here are various examples of extensions you can make to gpt-fast as PRs.\n- [Google Gemma](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fpull\u002F115)\n- [xAI Grok-1](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fpull\u002F171)\n- [Databricks DBRX](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fpull\u002F174)\n\n## Community\n\nProjects inspired by gpt-fast in the community:\n\n- [gpt-blazing](https:\u002F\u002Fgithub.com\u002Farmed-gpt\u002Fgpt-blazing): applies the same performance optimization strategy to more models (e.g., baichuan2).\n- [gptfast](https:\u002F\u002Fgithub.com\u002FMDK8888\u002FGPTFast): applies a subset of the performance optimizations to all Huggingface models\n- [gpt-accelera](https:\u002F\u002Fgithub.com\u002FEdward-Sun\u002Fgpt-accelera): extends `gpt-fast` to SFT\u002FRM\u002FPPO training and batched inference to optimize the throughput\n\n## Installation\n[Download PyTorch nightly](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F)\n\nInstall required packages:\n\n```bash\npip install -r requirements.txt\n```\n\nTo download llama models, go to https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlama-2-7b and go through steps to obtain access.\nThen login with `huggingface-cli login`\n\n\n\n## Downloading Weights\nModels tested\u002Fsupported\n```text\ntinyllamas\u002Fstories{15,42,100}\nopenlm-research\u002Fopen_llama_7b\nmeta-llama\u002FLlama-2-7b-chat-hf\nmeta-llama\u002FLlama-2-13b-chat-hf\nmeta-llama\u002FLlama-2-70b-chat-hf\ncodellama\u002FCodeLlama-7b-Python-hf\ncodellama\u002FCodeLlama-34b-Python-hf\nmistralai\u002FMistral-7B-v0.1\nmistralai\u002FMistral-7B-Instruct-v0.1\nmistralai\u002FMistral-7B-Instruct-v0.2\nmeta-llama\u002FMeta-Llama-3-8B\nmeta-llama\u002FMeta-Llama-3.1-8B\nmeta-llama\u002FMeta-Llama-3.1-70B\nmeta-llama\u002FMeta-Llama-3.1-405B\n```\n\nFor example, to convert Llama-2-7b-chat-hf\n```bash\nexport MODEL_REPO=meta-llama\u002FLlama-2-7b-chat-hf\n.\u002Fscripts\u002Fprepare.sh $MODEL_REPO\n```\n\n## Benchmarks\nBenchmarks run on an 8xA100-80GB, power limited to 330W with a hybrid cube mesh topology. Note that all benchmarks are run at *batch size=1*, making the reported tokens\u002Fs numbers equivalent to \"tokens\u002Fs\u002Fuser\". In addition, they are run with a very small prompt length (just 5 tokens).\n\n| Model    | Technique | Tokens\u002FSecond | Memory Bandwidth (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-7B  | Base    |  104.9  | 1397.31 |\n|           | 8-bit   | 155.58   | 1069.20 |\n|           | 4-bit (G=32)   | 196.80   | 862.69 |\n| Llama-2-70B | Base    | OOM     ||\n|           | 8-bit   | 19.13    | 1322.58 |\n|           | 4-bit (G=32)   | 25.25    | 1097.66 |\n| Llama-3.1-8B  | Base    |  93.89  | 1410.76 |\n|           | 8-bit   | 137.64   | 1030.89 |\n| Llama-3.1-70B | Base    | OOM     ||\n|           | 8-bit   | 18.04    | 1253.78 |\n\n### Speculative Sampling\n[Verifier: Llama-70B (int4), Draft: Llama-7B (int4)](.\u002Fscripts\u002Fspeculate_70B_int4.sh): 48.4 tok\u002Fs\n\n### Tensor Parallelism\n| Model    | Number of GPUs | Tokens\u002FSecond | Memory Bandwidth (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-7B  | 1    |  104.9  | 1397.31 |\n|           | 2   | 168.84   | 1181.99 |\n|           | 4   | 254.02   | 955.83 |\n|           | 8   | 328.43   | 704.10 |\n| Llama-2-70B  | 1    |  OOM  |  |\n|           | 2   | 21.32   | 1481.87 |\n|           | 4   | 38.01   | 1340.76 |\n|           | 8   | 62.50   | 1135.29 |\n| Llama-3.1-8B  | 1    |  93.83  | 1408.37 |\n|           | 2   | 149.10   | 1197.32 |\n|           | 4   | 217.21   | 986.32  |\n|           | 8   | 276.01   | 772.60 |\n| Llama-3.1-70B  | 1    |  OOM  |  |\n|           | 2   | 16.03   | 1130.81 |\n|           | 4   | 37.45   | 1360.53 |\n|           | 8   | 58.78   | 1129.61 |\n\n### Tensor Parallelism + Quantization\n| Model    | Technique | Tokens\u002FSecond | Memory Bandwidth (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-70B | Base    | 62.50     | 1135.29 |\n|           | 8-bit   | 80.44    | 752.04 |\n|           | 4-bit (G=32)   | 90.77    | 548.10 |\n| Llama-3.1-70B | Base    | 58.78     | 1129.61 |\n|           | 8-bit   | 75.58    | 726.57 |\n| Llama-3.1-405B | 8-bit | 15.60 | 815.87 |\n\n### AMD\nBenchmarks run on one GCD of a MI-250x.\n\n| Model    | Technique | Tokens\u002FSecond | Memory Bandwidth (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-7B  | Base    |  76.33  | 1028.70 |\n|           | 8-bit   | 101.86   | 700.06 |\n\n## Generate Text\n\nModel definition in `model.py`, generation code in `generate.py`.\n\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --prompt \"Hello, my name is\"\n```\n\nTo squeeze out a little bit more performance, you can also compile the prefill with `--compile_prefill`. This will increase compilation times though.\n\n## Quantization\nChoose device to use by\n```bash\n# The current support devices: cuda, cpu\nexport DEVICE=cuda\n```\n### Int8 Weight-Only Quantization\nTo generate this version of the model\n```bash\n# Spits out model at checkpoints\u002F$MODEL_REPO\u002Fmodel_int8.pth\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int8\n```\nTo run with int8, just pass the int8 checkpoint to generate.py.\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int8.pth --device $DEVICE\n```\n\n### Int4 Weight-Only Quantization\nTo generate int4 version of model\n```bash\n# Spits out model at checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.g32.$DEVICE.pth\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int4 --groupsize 32\n```\n\nTo run with int4, just pass the int4 checkpoint to generate.py.\n```bash\npython generate.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.g32.pth --compile\n```\n\n## Speculative Sampling\nTo generate with speculative sampling (DRAFT_MODEL_REPO should point to a smaller model compared with MODEL_REPO).\n\nIn this example, the \"smaller\" model is just the int8 quantized version of the model.\n```\nexport DRAFT_MODEL_REPO=meta-llama\u002FLlama-2-7b-chat-hf\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --draft_checkpoint_path checkpoints\u002F$DRAFT_MODEL_REPO\u002Fmodel_int8.pth\n```\n\nNote: Running on an A100 80GB, albeit power-limited to 330 watts. Empirically, seems like peak bandwidth is about 1700 GB\u002Fs.\n\n\n## Tensor Parallelism\n```bash\nENABLE_INTRA_NODE_COMM=1 torchrun --standalone --nproc_per_node=2 generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth\n```\n\n## Experimental\n### Evaluation\nWe use the EleutherAI evaluation harness to evaluate our model accuracy. To evaluate the accuracy, make sure the evaluation harness is installed and pass your model checkpoint and desired tasks to eval.py.\n\n```bash\npython eval.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --compile --tasks hellaswag winogrande\n```\n\nNote: Generative tasks are currently not supported for gpt-fast\n\nInstallation Instructions for the evaluation harness: https:\u002F\u002Fgithub.com\u002FEleutherAI\u002Flm-evaluation-harness\u002Ftree\u002Fmaster#install\n\n### GPTQ\nWe have a pure pytorch implementation of GPTQ that utilizes torch._dynamo.export to access the model structure. You can generate a GPTQ quantized\nversion of int4 quantization by using the same command to quantize it but adding 'gptq' to the quantization mode i.e.\n```bash\n# Spits out model at checkpoints\u002F$MODEL_REPO\u002Fmodel_int4-gptq.g32.pth\npython quantize.py --mode int4-gptq --calibration_tasks wikitext --calibration_seq_length 2048\n```\n\nYou can then eval or generate text with this model in the same way as above.\n\n## License\n\n`gpt-fast` is released under the [BSD 3](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fmain\u002FLICENSE) license.\n\n## Acknowledgements\nThanks to:\n* Lightning AI for supporting pytorch and work in flash attention, int8 quantization, and LoRA fine-tuning.\n* GGML for driving forward fast, on device inference of LLMs\n* Karpathy for spearheading simple, interpretable and fast LLM implementations\n* MLC-LLM for pushing 4-bit quantization performance on heterogeneous hardware\n","# gpt-fast\n简单高效的原生 PyTorch Transformer 文本生成。\n\n特点：\n1. 极低延迟\n2. 代码量少于 1000 行 Python\n3. 仅依赖 PyTorch 和 sentencepiece\n4. int8\u002Fint4 量化\n5. 推测解码\n6. 张量并行\n7. 支持 Nvidia 和 AMD 显卡\n\n这*不是*一个“框架”或“库”——它的目的是展示使用原生 PyTorch 可以达到怎样的性能 :) 欢迎随意复制、粘贴和 fork。\n\n如需深入了解此代码库的内容，请参阅这篇[博客文章](https:\u002F\u002Fpytorch.org\u002Fblog\u002Faccelerating-generative-ai-2\u002F)。\n\n## 支持的模型\n\n### LLaMA 系列\n请查看本页关于 LLaMA 系列模型的基准测试。\n\n### Mixtral 8x7B\n我们还支持了高质量的稀疏专家混合（MoE）模型 [Mixtral 8x7B](https:\u002F\u002Fmistral.ai\u002Fnews\u002Fmixtral-of-experts\u002F)，其平均 token 生成速率如下：\n\n|                  |   1 GPU |    2 GPU  | 4 GPU  |    8 GPU   |\n|------------------|---------|-----------|--------|------------|\n|baseline(bfloat16)|    OOM  |    96.67  | 155.35 |  227.82    |\n|        int8      |   97.92 |   155.03  | 216.87 |  279.35    |\n\n请注意，这些基准测试是在一台配备 8 块 A100-80GB 显卡、功率限制为 330W 且采用混合立方体网格拓扑的机器上运行的。所有基准测试均以 *batch size=1* 运行，因此报告的 tokens\u002Fs 数值等同于“tokens\u002Fs\u002Fuser”。此外，它们还使用非常短的提示长度（仅 5 个 token）。\n\n有关 Mixtral 8x7B 的更多详细信息，请参阅[此页面](.\u002Fmixtral-moe)或这篇[笔记](https:\u002F\u002Fthonking.substack.com\u002Fp\u002Fshort-supporting-mixtral-in-gpt-fast)。\n\n## 示例\n为了保持仓库的简洁性，以下是一些您可以作为 PR 提交到 gpt-fast 的扩展示例：\n- [Google Gemma](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fpull\u002F115)\n- [xAI Grok-1](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fpull\u002F171)\n- [Databricks DBRX](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fpull\u002F174)\n\n## 社区\n\n社区中受 gpt-fast 启发的项目：\n\n- [gpt-blazing](https:\u002F\u002Fgithub.com\u002Farmed-gpt\u002Fgpt-blazing)：将相同的性能优化策略应用于更多模型（例如 baichuan2）。\n- [gptfast](https:\u002F\u002Fgithub.com\u002FMDK8888\u002FGPTFast)：将部分性能优化应用到所有 Huggingface 模型。\n- [gpt-accelera](https:\u002F\u002Fgithub.com\u002FEdward-Sun\u002Fgpt-accelera)：扩展 `gpt-fast` 以支持 SFT\u002FRM\u002FPPO 训练及批处理推理，从而优化吞吐量。\n\n## 安装\n[下载 PyTorch nightly 版](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F)\n\n安装所需包：\n\n```bash\npip install -r requirements.txt\n```\n\n要下载 Llama 模型，请访问 https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlama-2-7b，并按照步骤获取访问权限。然后使用 `huggingface-cli login` 登录。\n\n\n\n## 下载权重\n已测试\u002F支持的模型\n```text\ntinyllamas\u002Fstories{15,42,100}\nopenlm-research\u002Fopen_llama_7b\nmeta-llama\u002FLlama-2-7b-chat-hf\nmeta-llama\u002FLlama-2-13b-chat-hf\nmeta-llama\u002FLlama-2-70b-chat-hf\ncodellama\u002FCodeLlama-7b-Python-hf\ncodellama\u002FCodeLlama-34b-Python-hf\nmistralai\u002FMistral-7B-v0.1\nmistralai\u002FMistral-7B-Instruct-v0.1\nmistralai\u002FMistral-7B-Instruct-v0.2\nmeta-llama\u002FMeta-Llama-3-8B\nmeta-llama\u002FMeta-Llama-3.1-8B\nmeta-llama\u002FMeta-Llama-3.1-70B\nmeta-llama\u002FMeta-Llama-3.1-405B\n```\n\n例如，要转换 Llama-2-7b-chat-hf：\n```bash\nexport MODEL_REPO=meta-llama\u002FLlama-2-7b-chat-hf\n.\u002Fscripts\u002Fprepare.sh $MODEL_REPO\n```\n\n## 基准测试\n基准测试在一台配备 8 块 A100-80GB 显卡、功率限制为 330W 且采用混合立方体网格拓扑的机器上进行。请注意，所有基准测试均以 *batch size=1* 运行，因此报告的 tokens\u002Fs 数值等同于“tokens\u002Fs\u002Fuser”。此外，它们还使用非常短的提示长度（仅 5 个 token）。\n\n| 模型    | 技术 | Tokens\u002FSecond | 内存带宽 (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-7B  | Base    |  104.9  | 1397.31 |\n|           | 8-bit   | 155.58   | 1069.20 |\n|           | 4-bit (G=32)   | 196.80   | 862.69 |\n| Llama-2-70B | Base    | OOM     ||\n|           | 8-bit   | 19.13    | 1322.58 |\n|           | 4-bit (G=32)   | 25.25    | 1097.66 |\n| Llama-3.1-8B  | Base    |  93.89  | 1410.76 |\n|           | 8-bit   | 137.64   | 1030.89 |\n| Llama-3.1-70B | Base    | OOM     ||\n|           | 8-bit   | 18.04    | 1253.78 |\n\n### 推测采样\n[验证器：Llama-70B (int4)，草稿：Llama-7B (int4)](.\u002Fscripts\u002Fspeculate_70B_int4.sh)：48.4 tok\u002Fs\n\n### 张量并行\n| 模型    | GPU 数量 | Tokens\u002FSecond | 内存带宽 (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-7B  | 1    |  104.9  | 1397.31 |\n|           | 2   | 168.84   | 1181.99 |\n|           | 4   | 254.02   | 955.83 |\n|           | 8   | 328.43   | 704.10 |\n| Llama-2-70B  | 1    |  OOM  |  |\n|           | 2   | 21.32   | 1481.87 |\n|           | 4   | 38.01   | 1340.76 |\n|           | 8   | 62.50   | 1135.29 |\n| Llama-3.1-8B  | 1    |  93.83  | 1408.37 |\n|           | 2   | 149.10   | 1197.32 |\n|           | 4   | 217.21   | 986.32  |\n|           | 8   | 276.01   | 772.60 |\n| Llama-3.1-70B  | 1    |  OOM  |  |\n|           | 2   | 16.03   | 1130.81 |\n|           | 4   | 37.45   | 1360.53 |\n|           | 8   | 58.78   | 1129.61 |\n\n### 张量并行 + 量化\n| 模型    | 技术 | Tokens\u002FSecond | 内存带宽 (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-70B | Base    | 62.50     | 1135.29 |\n|           | 8-bit   | 80.44    | 752.04 |\n|           | 4-bit (G=32)   | 90.77    | 548.10 |\n| Llama-3.1-70B | Base    | 58.78     | 1129.61 |\n|           | 8-bit   | 75.58    | 726.57 |\n| Llama-3.1-405B | 8-bit | 15.60 | 815.87 |\n\n### AMD\n基准测试在一块 MI-250x 的 GCD 上进行。\n\n| 模型    | 技术 | Tokens\u002FSecond | 内存带宽 (GB\u002Fs) |\n| -------- | ------- | ------ | ------ |\n| Llama-2-7B  | Base    |  76.33  | 1028.70 |\n|           | 8-bit   | 101.86   | 700.06 |\n\n## 生成文本\n\n模型定义位于 `model.py`，生成代码位于 `generate.py`。\n\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --prompt \"Hello, my name is\"\n```\n\n为了进一步提升性能，您还可以通过 `--compile_prefill` 编译预填充部分。不过，这会增加编译时间。\n\n## 量化\n选择设备：\n```bash\n# 当前支持的设备：cuda、cpu\nexport DEVICE=cuda\n```\n### Int8 仅权重量化\n要生成该版本的模型：\n```bash\n# 输出模型至 checkpoints\u002F$MODEL_REPO\u002Fmodel_int8.pth\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int8\n```\n要使用 int8 模型，只需将 int8 checkpoint 传递给 generate.py 即可。\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int8.pth --device $DEVICE\n```\n\n### Int4 仅权重量化\n要生成 int4 版本的模型：\n```bash\n# Spits out model at checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.pth\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int4\n```\n要使用 int4 模型，只需将 int4 checkpoint 传递给 generate.py 即可。\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.pth --device $DEVICE\n```\n\n### Int4 仅权重量化\n要生成 int4 版本的模型：\n```bash\n# Spits out model at checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.pth\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int4\n```\n要使用 int4 模型，只需将 int4 checkpoint 传递给 generate.py 即可。\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.pth --device $DEVICE\n```\n\n# 在检查点目录下输出模型：checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.g32.$DEVICE.pth\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int4 --groupsize 32\n```\n\n要使用 int4 模式运行，只需将 int4 检查点传递给 generate.py 即可。\n```bash\npython generate.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.g32.pth --compile\n```\n\n## 推测采样\n要使用推测采样进行生成（DRAFT_MODEL_REPO 应指向一个比 MODEL_REPO 更小的模型）。\n\n在本示例中，“更小”的模型只是该模型的 int8 量化版本。\n```\nexport DRAFT_MODEL_REPO=meta-llama\u002FLlama-2-7b-chat-hf\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --draft_checkpoint_path checkpoints\u002F$DRAFT_MODEL_REPO\u002Fmodel_int8.pth\n```\n\n注意：运行环境为 A100 80GB 显卡，但功耗被限制在 330 瓦。根据经验，峰值带宽约为 1700 GB\u002Fs。\n\n\n## 张量并行\n```bash\nENABLE_INTRA_NODE_COMM=1 torchrun --standalone --nproc_per_node=2 generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth\n```\n\n## 实验性功能\n### 评估\n我们使用 EleutherAI 的评估框架来评估模型的准确性。要评估准确性，请确保已安装该评估框架，并将模型检查点和所需任务传递给 eval.py。\n\n```bash\npython eval.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --compile --tasks hellaswag winogrande\n```\n\n注意：目前 gpt-fast 不支持生成类任务。\n\n评估框架的安装说明：https:\u002F\u002Fgithub.com\u002FEleutherAI\u002Flm-evaluation-harness\u002Ftree\u002Fmaster#install\n\n### GPTQ\n我们有一个纯 PyTorch 实现的 GPTQ，它利用 torch._dynamo.export 来访问模型结构。你可以通过与量化相同的命令生成 GPTQ 量化的 int4 版本，只需在量化模式中添加 'gptq' 即可，例如：\n```bash\n# 在 checkpoints\u002F$MODEL_REPO 目录下输出模型：model_int4-gptq.g32.pth\npython quantize.py --mode int4-gptq --calibration_tasks wikitext --calibration_seq_length 2048\n```\n\n之后，你可以像上述方法一样对该模型进行评估或文本生成。\n\n## 许可证\n\n`gpt-fast` 根据 [BSD 3](https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fmain\u002FLICENSE) 许可证发布。\n\n## 致谢\n感谢以下机构和个人：\n* Lightning AI 对 PyTorch 的支持，以及在 Flash Attention、int8 量化和 LoRA 微调方面的工作。\n* GGML 推动了 LLM 的快速设备端推理技术。\n* Karpathy 领导了简单、可解释且快速的 LLM 实现。\n* MLC-LLM 在异构硬件上提升了 4 位量化性能。","# gpt-fast 快速上手指南\n\ngpt-fast 是一个基于原生 PyTorch 构建的极简、高效 Transformer 文本生成项目。它无需复杂框架，仅依赖 PyTorch 和 sentencepiece，通过极少的代码量（\u003C1000 行）实现了低延迟推理、int8\u002Fint4 量化、投机采样（Speculative Decoding）及张量并行等高级特性。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**: Linux (推荐)\n- **GPU**: 支持 NVIDIA (CUDA) 或 AMD (ROCm) GPU\n- **Python**: 3.8+\n\n### 前置依赖\n本项目核心依赖为 **PyTorch Nightly** 版本以获得最佳性能支持，以及 `sentencepiece`。\n\n> **国内加速建议**：\n> 安装 PyTorch 时，建议使用清华大学或阿里云镜像源加速下载。\n\n## 安装步骤\n\n### 1. 安装 PyTorch Nightly\n访问 [PyTorch 官网](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F) 获取最新命令，或使用以下通用命令（以 CUDA 12.1 为例，国内用户可替换 pip 源）：\n\n```bash\npip3 install --pre torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fnightly\u002Fcu121\n# 国内镜像加速示例 (清华源可能不包含 nightly，建议官方源或寻找特定 nightly 镜像)\n# pip3 install --pre torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fnightly\u002Fcu121\n```\n\n*注：AMD 用户请安装对应的 ROCm 版本 PyTorch。*\n\n### 2. 克隆项目并安装依赖\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast.git\ncd gpt-fast\npip install -r requirements.txt\n```\n\n### 3. 配置 Hugging Face 访问\n下载 LLaMA 等模型需要 Hugging Face 权限。\n1. 前往 [Hugging Face Llama-2 页面](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlama-2-7b) 申请访问权限。\n2. 在终端登录：\n```bash\nhuggingface-cli login\n```\n> **提示**：如果网络连接不稳定，建议在终端设置代理或使用国内镜像站下载模型权重后手动放入目录。\n\n## 基本使用\n\n### 1. 下载并准备模型权重\n以 `Llama-2-7b-chat-hf` 为例，运行脚本将模型转换为 gpt-fast 格式：\n\n```bash\nexport MODEL_REPO=meta-llama\u002FLlama-2-7b-chat-hf\n.\u002Fscripts\u002Fprepare.sh $MODEL_REPO\n```\n*支持模型包括：Llama-2\u002F3 系列、CodeLlama、Mistral、Mixtral 等（详见 README Supported Models 列表）。*\n\n### 2. 生成文本\n使用默认精度进行文本生成：\n\n```bash\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --prompt \"Hello, my name is\"\n```\n\n**参数说明：**\n- `--compile`: 启用 `torch.compile` 进行加速（首次运行会有编译耗时）。\n- `--checkpoint_path`: 指向转换后的模型权重文件。\n- `--prompt`: 输入提示词。\n\n### 3. (可选) 使用量化模型加速\n为了进一步降低显存占用并提升速度，推荐使用 int8 或 int4 量化。\n\n**生成 int8 模型并运行：**\n```bash\n# 1. 量化权重\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int8\n\n# 2. 运行生成 (指定 int8 权重)\npython generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int8.pth --device cuda\n```\n\n**生成 int4 模型并运行：**\n```bash\n# 1. 量化权重 (groupsize=32)\npython quantize.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth --mode int4 --groupsize 32\n\n# 2. 运行生成\npython generate.py --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel_int4.g32.pth --compile\n```\n\n### 4. (可选) 多卡张量并行\n对于大模型（如 70B），单卡显存不足时可利用多卡并行：\n\n```bash\nENABLE_INTRA_NODE_COMM=1 torchrun --standalone --nproc_per_node=2 generate.py --compile --checkpoint_path checkpoints\u002F$MODEL_REPO\u002Fmodel.pth\n```\n*将 `--nproc_per_node` 修改为你拥有的 GPU 数量。*","某初创团队需要在单张消费级显卡上部署 Llama-3-8B 模型，为内部开发文档系统提供实时的代码补全与问答服务。\n\n### 没有 gpt-fast 时\n- **显存爆满无法运行**：直接加载原始浮点精度模型会导致显存溢出（OOM），团队被迫升级昂贵的多卡服务器或放弃本地部署。\n- **响应延迟过高**：生成每个 token 的耗时较长，用户输入后需等待数秒才能看到首个字，严重打断编程思路。\n- **环境依赖复杂**：需要安装庞大的推理框架及多种第三方库，环境配置繁琐且容易引发版本冲突。\n- **硬件利用率低**：无法有效利用 AMD 显卡或非顶级 Nvidia 显卡的算力，导致现有硬件资源闲置浪费。\n\n### 使用 gpt-fast 后\n- **量化技术降低门槛**：借助 int4\u002Fint8 量化技术，成功将 8B 模型压缩至单张消费级显卡显存内，无需额外硬件投入即可运行。\n- **极致低延迟体验**：得益于原生 PyTorch 的高效实现与推测解码（Speculative decoding），首字生成几乎无感，流畅度媲美商业 API。\n- **极简部署流程**：仅需 PyTorch 和 sentencepiece 两个依赖，不到 1000 行代码即可跑通，复制粘贴即可快速集成到现有项目。\n- **广泛硬件兼容**：完美支持 Nvidia 和 AMD GPU，团队得以复用旧的 AMD 测试机进行推理，大幅降低了运营成本。\n\ngpt-fast 通过极致的代码精简与量化加速，让高性能大模型推理从“昂贵集群专属”变成了“单卡日常可用”。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmeta-pytorch_gpt-fast_1fccf6c2.png","meta-pytorch","Meta PyTorch","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmeta-pytorch_1dfd3f76.jpg","",null,"https:\u002F\u002Fpytorch.org","https:\u002F\u002Fgithub.com\u002Fmeta-pytorch",[22,26],{"name":23,"color":24,"percentage":25},"Python","#3572A5",98.5,{"name":27,"color":28,"percentage":29},"Shell","#89e051",1.5,6190,572,"2026-04-02T07:11:55","BSD-3-Clause",3,"Linux","必需。支持 NVIDIA (如 A100-80GB) 和 AMD (如 MI-250x) GPU。显存需求取决于模型大小：运行 Llama-2-7B 需约 14GB+ (BF16)，Llama-2-70B 需多卡或量化 (int8\u002Fint4) 才能运行。基准测试环境为 8xA100-80GB。","未说明 (建议根据模型参数量配置，大模型需大量系统内存)",{"notes":39,"python":40,"dependencies":41},"1. 该项目旨在展示原生 PyTorch 性能，非通用框架，鼓励直接复制代码使用。\n2. 必须下载 PyTorch 夜间构建版 (nightly)。\n3. 支持 int8 和 int4 权重量化以降低显存需求并提升速度。\n4. 支持推测解码 (Speculative decoding) 和张量并行 (Tensor parallelism)。\n5. 下载 LLaMA 系列模型需先通过 Hugging Face 申请访问权限并登录。","未说明 (需安装 PyTorch nightly 版本)",[42,43],"torch (nightly build)","sentencepiece",[45,46],"语言模型","开发框架",2,"ready","2026-03-27T02:49:30.150509","2026-04-06T08:45:20.654316",[52,57,62,67,72,77],{"id":53,"question_zh":54,"answer_zh":55,"source_url":56},15555,"在双 RTX 4090 显卡上运行张量并行（Tensor Parallelism）时程序卡死怎么办？","这是因为 RTX 4090 显卡禁用了 P2P（点对点）访问，而 NCCL 默认尝试使用它。解决方法是在运行命令前设置环境变量：`export NCCL_P2P_DISABLE=1`。设置后通常可以解决初始化或 all_reduce 阶段的挂起问题。","https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fissues\u002F55",{"id":58,"question_zh":59,"answer_zh":60,"source_url":61},15556,"为什么 Meta-Llama-3-8B-Instruct 模型在处理长提示词（Prompt）时会生成乱码？","这是因为 `rope_theta` 参数未正确设置。Llama 3 需要更大的旋转位置编码阈值。解决方法是手动将 `rope_theta` 设置为 `500000.0`。该修复已在后续代码更新中合并。","https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fissues\u002F179",{"id":63,"question_zh":64,"answer_zh":65,"source_url":66},15557,"启用推测解码（Speculative Decoding）并设置 `ENABLE_INTRA_NODE_COMM=1` 后，程序运行几次迭代后卡死是什么原因？","这是一个已知问题，通常与数据依赖性导致的死锁有关。临时解决方法是在每次迭代开始时调用 `manual_seed` 重置随机种子。此外，相关的 PyTorch PR (https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fpytorch\u002Fpull\u002F129501) 旨在从根本上修复此问题，建议升级 PyTorch 版本。","https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fissues\u002F183",{"id":68,"question_zh":69,"answer_zh":70,"source_url":71},15558,"在 AMD GPU 或使用推测解码时，为什么编译后速度反而变慢并出现 'skipping cudagraphs due to mutated inputs' 警告？","该警告表明由于输入数据发生突变（mutated inputs），导致无法使用 CUDA Graphs 进行加速，从而引起性能大幅下降（例如从 33 tokens\u002Fs 降至 7 tokens\u002Fs）。这通常发生在推测解码场景中，因为草稿模型和目标模型的交互可能导致输入状态变更。目前需关注官方是否修复了对突变输入的 CUDA Graph 支持，或尝试调整解码策略以减少状态突变。","https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fissues\u002F21",{"id":73,"question_zh":74,"answer_zh":75,"source_url":76},15559,"为什么 `torch.compile()` 能显著加速 gpt-fast，但对 Hugging Face Transformers 模型几乎没有加速效果？","gpt-fast 针对 `torch.compile` 进行了深度优化，特别是实现了静态 KV Cache 分配和减少了 CPU 开销。而标准的 Hugging Face 模型实现中包含了动态控制流和未优化的内存分配，导致 TorchInductor 无法有效融合算子。若要获得类似加速，需参考 gpt-fast 的实现逻辑，对 HF 模型进行重构以支持静态形状和静态缓存分配。","https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fgpt-fast\u002Fissues\u002F59",{"id":78,"question_zh":79,"answer_zh":80,"source_url":56},15560,"如何在多卡环境下正确配置并运行张量并行（TP）示例？","推荐使用 `torchrun` 启动脚本。例如运行 2 卡并行：`torchrun --standalone --nproc_per_node=2 generate.py --checkpoint_path \u003Cpath> ...`。如果遇到挂起问题，请确保设置 `export NCCL_P2P_DISABLE=1`（特别是消费级显卡如 4090），并使用 `nvidia-smi topo -m` 检查显卡拓扑连接是否正常。",[],[83,93,101,109,117,130],{"id":84,"name":85,"github_repo":86,"description_zh":87,"stars":88,"difficulty_score":34,"last_commit_at":89,"category_tags":90,"status":48},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",[46,91,92],"图像","Agent",{"id":94,"name":95,"github_repo":96,"description_zh":97,"stars":98,"difficulty_score":47,"last_commit_at":99,"category_tags":100,"status":48},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 真正成长为懂上",140436,"2026-04-05T23:32:43",[46,92,45],{"id":102,"name":103,"github_repo":104,"description_zh":105,"stars":106,"difficulty_score":47,"last_commit_at":107,"category_tags":108,"status":48},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",[46,91,92],{"id":110,"name":111,"github_repo":112,"description_zh":113,"stars":114,"difficulty_score":47,"last_commit_at":115,"category_tags":116,"status":48},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",[46,45],{"id":118,"name":119,"github_repo":120,"description_zh":121,"stars":122,"difficulty_score":47,"last_commit_at":123,"category_tags":124,"status":48},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",[91,125,126,127,92,128,45,46,129],"数据工具","视频","插件","其他","音频",{"id":131,"name":132,"github_repo":133,"description_zh":134,"stars":135,"difficulty_score":34,"last_commit_at":136,"category_tags":137,"status":48},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",[92,91,46,45,128]]