Lightning-AI/litgpt

GitHub: Lightning-AI/litgpt

一个提供 20+ 高性能大语言模型及预训练、微调、部署完整方案的开源 AI 框架。

Stars: 13553 | Forks: 1477

# ⚡ LitGPT **20+ 高性能 LLM,附带用于大规模预训练、微调和部署的方案。**

✅ 从头实现      ✅ 无抽象         ✅ 对初学者友好

   ✅ Flash attention                   ✅ FSDP                    ✅ LoRA, QLoRA, Adapter

✅ 减少 GPU 内存 (fp4/8/16/32)   ✅ 1-1000+ GPUs/TPUs       ✅ 20+ LLMs         



![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytorch-lightning)

![cpu-tests](https://static.pigsec.cn/wp-content/uploads/repos/cas/2d/2d7552944d6c670b12f080d9c5bde2774a3480fa2b1af30811c0c581680820dd.svg) [![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/Lightning-AI/litgpt/blob/main/LICENSE.md) [![Discord](https://img.shields.io/discord/1077906959069626439)](https://discord.gg/VptPCZkGNa)

快速开始模型微调部署所有工作流功能特性方案Lightning AI教程

  Get started  
# 快如闪电地微调、预训练和推理 LLM ⚡⚡ 每个 LLM 都是**无抽象**且**完全可控**的从头实现,使它们在企业级规模下极其快速、精简且高性能。 ✅ **企业就绪 -** Apache 2.0 许可证,无限制的企业用途。
✅ **开发者友好 -** 无抽象层和单文件实现,便于调试。
✅ **性能优化 -** 专为最大化性能、降低成本和加速训练而设计的模型。
✅ **经过验证的方案 -** 在企业级规模下测试过的高度优化的训练/微调方案。
  # 快速开始 安装 LitGPT ``` pip install 'litgpt[extra]' ``` 加载并使用任何 [20+ LLMs](#choose-from-20-llms): ``` from litgpt import LLM llm = LLM.load("microsoft/phi-2") text = llm.generate("Fix the spelling: Every fall, the family goes to the mountains.") print(text) # 修正后的句子:每年秋天,这家人都会去山区。 ```   ✅ 针对快速推理进行了优化
✅ 量化
✅ 可在低内存 GPU 上运行
✅ 无内部抽象层
✅ 针对生产规模进行了优化
高级安装选项 从源码安装: ``` git clone https://github.com/Lightning-AI/litgpt cd litgpt # 如果使用 uv uv sync --all-extras # 如果使用 pip pip install -e ".[extra,compiler,test]" ```
[探索完整的 Python API 文档](tutorials/python-api.md)。   # 从 20+ LLM 中进行选择 每个模型都是从零开始编写的,以最大化性能并消除抽象层: | 模型 | 模型规模 | 作者 | 参考 | |----|----|----|----| | Llama 3, 3.1, 3.2, 3.3 | 1B, 3B, 8B, 70B, 405B | Meta AI | [Meta AI 2024](https://github.com/meta-llama/llama3) | | Code Llama | 7B, 13B, 34B, 70B | Meta AI | [Rozière et al. 2023](https://arxiv.org/abs/2308.12950) | | CodeGemma | 7B | Google | [Google Team, Google Deepmind](https://ai.google.dev/gemma/docs/codegemma) | | Gemma 2 | 2B, 9B, 27B | Google | [Google Team, Google Deepmind](https://storage.googleapis.com/deepmind-media/gemma/gemma-2-report.pdf) | | Phi 4 | 14B | Microsoft Research | [Abdin et al. 2024](https://arxiv.org/abs/2412.08905) | | Qwen2.5 | 0.5B, 1.5B, 3B, 7B, 14B, 32B, 72B | Alibaba Group | [Qwen Team 2024](https://qwenlm.github.io/blog/qwen2.5/) | | Qwen2.5 Coder | 0.5B, 1.5B, 3B, 7B, 14B, 32B | Alibaba Group | [Hui, Binyuan et al. 2024](https://arxiv.org/abs/2409.12186) | | R1 Distill Llama | 8B, 70B | DeepSeek AI | [DeepSeek AI 2025](https://github.com/deepseek-ai/DeepSeek-R1/blob/main/DeepSeek_R1.pdf) | | ... | ... | ... | ... |
查看 20+ LLM 的完整列表   #### 所有模型 | 模型 | 模型规模 | 作者 | 参考 | |----|----|----|----| | CodeGemma | 7B | Google | [Google Team, Google Deepmind](https://ai.google.dev/gemma/docs/codegemma) | | Code Llama | 7B, 13B, 34B, 70B | Meta AI | [Rozière et al. 2023](https://arxiv.org/abs/2308.12950) | | Falcon | 7B, 40B, 180B | TII UAE | [TII 2023](https://falconllm.tii.ae) | | Falcon 3 | 1B, 3B, 7B, 10B | TII UAE | [TII 2024](https://huggingface.co/blog/falcon3) | | FreeWilly2 (Stable Beluga 2) | 70B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stable-beluga-large-instruction-fine-tuned-models) | | Function Calling Llama 2 | 7B | Trelis | [Trelis et al. 2023](https://huggingface.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2) | | Gemma | 2B, 7B | Google | [Google Team, Google Deepmind](https://storage.googleapis.com/deepmind-media/gemma/gemma-report.pdf) | | Gemma 2 | 9B, 27B | Google | [Google Team, Google Deepmind](https://storage.googleapis.com/deepmind-media/gemma/gemma-2-report.pdf) | | Gemma 3 | 1B, 4B, 12B, 27B | Google | [Google Team, Google Deepmind](https://arxiv.org/pdf/2503.19786) | | Llama 2 | 7B, 13B, 70B | Meta AI | [Touvron et al. 2023](https://arxiv.org/abs/2307.09288) | | Llama 3.1 | 8B, 70B | Meta AI | [Meta AI 2024](https://github.com/meta-llama/llama3) | | Llama 3.2 | 1B, 3B | Meta AI | [Meta AI 2024](https://ai.meta.com/blog/llama-3-2-connect-2024-vision-edge-mobile-devices/) | | Llama 3.3 | 70B | Meta AI | [Meta AI 2024](https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct) | | Mathstral | 7B | Mistral AI | [Mistral AI 2024](https://mistral.ai/news/mathstral/) | | MicroLlama | 300M | Ken Wang | [MicroLlama repo](https://github.com/keeeeenw/MicroLlama) | | Mixtral MoE | 8x7B | Mistral AI | [Mistral AI 2023](https://mistral.ai/news/mixtral-of-experts/) | | Mistral | 7B, 123B | Mistral AI | [Mistral AI 2023](https://mistral.ai/news/announcing-mistral-7b/) | | Mixtral MoE | 8x22B | Mistral AI | [Mistral AI 2024](https://mistral.ai/news/mixtral-8x22b/) | | OLMo | 1B, 7B | Allen Institute for AI (AI2) | [Groeneveld et al. 2024](https://aclanthology.org/2024.acl-long.841/) | | OpenLLaMA | 3B, 7B, 13B | OpenLM Research | [Geng & Liu 2023](https://github.com/openlm-research/open_llama) | | Phi 1.5 & 2 | 1.3B, 2.7B | Microsoft Research | [Li et al. 2023](https://arxiv.org/abs/2309.05463) | | Phi 3 | 3.8B | Microsoft Research | [Abdin et al. 2024](https://arxiv.org/abs/2404.14219) | | Phi 4 | 14B | Microsoft Research | [Abdin et al. 2024](https://arxiv.org/abs/2412.08905) | | Phi 4 Mini Instruct | 3.8B | Microsoft Research | [Microsoft 2025](https://arxiv.org/abs/2503.01743) | | Phi 4 Mini Reasoning | 3.8B | Microsoft Research | [Xu, Peng et al. 2025](https://arxiv.org/abs/2504.21233) | | Phi 4 Reasoning | 3.8B | Microsoft Research | [Abdin et al. 2025](https://arxiv.org/abs/2504.21318) | | Phi 4 Reasoning Plus | 3.8B | Microsoft Research | [Abdin et al. 2025](https://arxiv.org/abs/2504.21318) | | Platypus | 7B, 13B, 70B | Lee et al. | [Lee, Hunter, and Ruiz 2023](https://arxiv.org/abs/2308.07317) | | Pythia | {14,31,70,160,410}M, {1,1.4,2.8,6.9,12}B | EleutherAI | [Biderman et al. 2023](https://arxiv.org/abs/2304.01373) | | Qwen2.5 | 0.5B, 1.5B, 3B, 7B, 14B, 32B, 72B | Alibaba Group | [Qwen Team 2024](https://qwenlm.github.io/blog/qwen2.5/) | | Qwen2.5 Coder | 0.5B, 1.5B, 3B, 7B, 14B, 32B | Alibaba Group | [Hui, Binyuan et al. 2024](https://arxiv.org/abs/2409.12186) | | Qwen2.5 1M (长上下文) | 7B, 14B | Alibaba Group | [Qwen Team 2025](https://qwenlm.github.io/blog/qwen2.5-1m/) | | Qwen2.5 Math | 1.5B, 7B, 72B | Alibaba Group | [An, Yang et al. 2024](https://arxiv.org/abs/2409.12122) | | QwQ | 32B | Alibaba Group | [Qwen Team 2025](https://qwenlm.github.io/blog/qwq-32b/) | | QwQ-Preview | 32B | Alibaba Group | [Qwen Team 2024](https://qwenlm.github.io/blog/qwq-32b-preview/) | | Qwen3 | 0.6B, 1.7B, 4B{Hybrid, Thinking-2507, Instruct-2507}, 8B, 14B, 32B | Alibaba Group | [Qwen Team 2025](https://arxiv.org/abs/2505.09388/) | | Qwen3 MoE | 30B{Hybrid, Thinking-2507, Instruct-2507}, 235B{Hybrid, Thinking-2507, Instruct-2507} | Alibaba Group | [Qwen Team 2025](https://arxiv.org/abs/2505.09388/) | | R1 Distill Llama | 8B, 70B | DeepSeek AI | [DeepSeek AI 2025](https://github.com/deepseek-ai/DeepSeek-R1/blob/main/DeepSeek_R1.pdf) | | SmolLM2 | 135M, 360M, 1.7B | Hugging Face | [Hugging Face 2024](https://github.com/huggingface/smollm) | | Salamandra | 2B, 7B | Barcelona Supercomputing Centre | [BSC-LTC 2024](https://github.com/BSC-LTC/salamandra) | | StableCode | 3B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stablecode-llm-generative-ai-coding) | | StableLM | 3B, 7B | Stability AI | [Stability AI 2023](https://github.com/Stability-AI/StableLM) | | StableLM Zephyr | 3B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stablecode-llm-generative-ai-coding) | | TinyLlama | 1.1B | Zhang et al. | [Zhang et al. 2023](https://github.com/jzhang38/TinyLlama) | **提示**:您可以通过运行 `litgpt download list` 命令列出所有可用的模型。
  # 工作流

微调预训练持续预训练评估部署测试

  使用命令行界面运行高级工作流,例如在您自己的数据上进行预训练或微调。 ## 所有工作流 安装 LitGPT 后,选择要运行的模型和工作流(微调、预训练、评估、部署等): ``` # litgpt [action] [model] litgpt serve meta-llama/Llama-3.2-3B-Instruct litgpt finetune meta-llama/Llama-3.2-3B-Instruct litgpt pretrain meta-llama/Llama-3.2-3B-Instruct litgpt chat meta-llama/Llama-3.2-3B-Instruct litgpt evaluate meta-llama/Llama-3.2-3B-Instruct ```   ## 微调 LLM
Run on Studios
  微调是指采用预训练的 AI 模型,并在针对特定任务或应用定制的更小、更专门的数据集上进一步训练的过程。   ``` # 0) 设置你的 dataset curl -L https://huggingface.co/datasets/ksaw008/finance_alpaca/resolve/main/finance_alpaca.json -o my_custom_dataset.json # 1) Finetune 一个 model(自动下载 weights) litgpt finetune microsoft/phi-2 \ --data JSON \ --data.json_path my_custom_dataset.json \ --data.val_split_fraction 0.1 \ --out_dir out/custom-model # 2) 测试 model litgpt chat out/custom-model/final # 3) 髟署 model litgpt serve out/custom-model/final ``` [阅读完整的微调文档](tutorials/finetune.md)   ## 部署 LLM
Deploy on Studios
  部署预训练或微调的 LLM,以便在真实应用中使用它。部署后会自动设置一个 Web 服务器,可由网站或应用访问。 ``` # 部署一个开箱即用的 LLM litgpt serve microsoft/phi-2 # 部署你自己的 trained model litgpt serve path/to/microsoft/phi-2/checkpoint ```
显示查询服务器的代码:   在单独的终端中测试服务器,并将模型 API 集成到您的 AI 产品中: ``` # 3) 使用 server(在单独的 Python session 中) import requests, json response = requests.post( "http://127.0.0.1:8000/predict", json={"prompt": "Fix typos in the following sentence: Example input"} ) print(response.json()["output"]) ```
[阅读完整的部署文档](tutorials/deploy.md)。   ## 评估 LLM 评估 LLM 以测试其在各种任务中的表现,看看它对文本的理解和生成程度如何。简而言之,我们可以评估它在大学级别的化学、编程等方面的表现(MMLU、Truthful QA 等)。 ``` litgpt evaluate microsoft/phi-2 --tasks 'truthfulqa_mc2,mmlu' ``` [阅读完整的评估文档](tutorials/evaluation.md)。   ## 测试 LLM
Run on Studios
  通过交互式聊天测试模型的效果如何。使用 `chat` 命令进行聊天、提取 embedding 等。 以下示例展示了如何使用 Phi-2 LLM: ``` litgpt chat microsoft/phi-2 >> Prompt: What do Llamas eat? ```
完整代码:   ``` # 1) 列出所有支持的 LLM litgpt download list # 2) 使用一个 model(自动下载 weights) litgpt chat microsoft/phi-2 >> Prompt: What do Llamas eat? ``` 某些模型的下载需要额外的访问 token。您可以在[下载](tutorials/download_model_weights.md#specific-models-and-access-tokens)文档中了解更多相关信息。
[阅读完整的聊天文档](tutorials/inference.md)。   ## 预训练 LLM
Run on Studios
  预训练是指在针对特定任务对 AI 模型进行微调之前,通过让其接触大量数据来进行教学的过程。
显示代码:   ``` mkdir -p custom_texts curl https://www.gutenberg.org/cache/epub/24440/pg24440.txt --output custom_texts/book1.txt curl https://www.gutenberg.org/cache/epub/26393/pg26393.txt --output custom_texts/book2.txt # 1) 下载一个 tokenizer litgpt download EleutherAI/pythia-160m \ --tokenizer_only True # 2) Pretrain model litgpt pretrain EleutherAI/pythia-160m \ --tokenizer_dir EleutherAI/pythia-160m \ --data TextFiles \ --data.train_data_path "custom_texts/" \ --train.max_tokens 10_000_000 \ --out_dir out/custom-model # 3) 测试 model litgpt chat out/custom-model/final ```
[阅读完整的预训练文档](tutorials/pretrain.md)   ## 持续预训练 LLM
Run on Studios
  持续预训练是另一种微调方式,它通过在自定义数据上进行训练,使已经预训练的模型更加专业化:
显示代码:   ``` mkdir -p custom_texts curl https://www.gutenberg.org/cache/epub/24440/pg24440.txt --output custom_texts/book1.txt curl https://www.gutenberg.org/cache/epub/26393/pg26393.txt --output custom_texts/book2.txt # 1) 继续预训练一个 model(自动下载 weights) litgpt pretrain EleutherAI/pythia-160m \ --tokenizer_dir EleutherAI/pythia-160m \ --initial_checkpoint_dir EleutherAI/pythia-160m \ --data TextFiles \ --data.train_data_path "custom_texts/" \ --train.max_tokens 10_000_000 \ --out_dir out/custom-model # 2) 测试 model litgpt chat out/custom-model/final ```
[阅读完整的持续预训练文档](tutorials/pretrain.md#continued-pretraining-on-custom-data)   # 最先进的功能特性 ✅ 最先进的优化:Flash Attention v2、通过 fully-sharded data parallelism 实现的多 GPU 支持、[可选的 CPU offloading](tutorials/oom.md#do-sharding-across-multiple-gpus),以及 [TPU 和 XLA 支持](extensions/xla)。
✅ [预训练](tutorials/pretrain.md)、[微调](tutorials/finetune.md)和[部署](tutorials/inference.md)
✅ 通过低精度设置减少计算需求:FP16、BF16 和 FP16/FP32 混合。
✅ 通过[量化](tutorials/quantize.md)降低内存需求:4-bit 浮点数、8-bit 整数和双重量化。
✅ [配置文件](config_hub)提供出色的开箱即用性能。
✅ 参数高效微调:[LoRA](tutorials/finetune_lora.md)、[QLoRA](tutorials/finetune_lora.md)、[Adapter](tutorials/finetune_adapter.md) 和 [Adapter v2](tutorials/finetune_adapter.md)。
✅ [导出](tutorials/convert_lit_models.md)为其他流行的模型权重格式。
✅ 许多用于[预训练](tutorials/pretrain.md)和[微调](tutorials/prepare_dataset.md)的流行数据集,并[支持自定义数据集](tutorials/prepare_dataset.md#preparing-custom-datasets-for-instruction-finetuning)。
✅ 可读且易于修改的代码,方便用最新的研究想法进行实验。
  # 训练方案 LitGPT 附带了经过验证的方案(YAML 配置),可在不同条件下训练模型。我们根据发现在不同训练条件下表现最好的参数生成了这些方案。 在[此处](config_hub)浏览所有训练方案。 ### 示例 ``` litgpt finetune \ --config https://raw.githubusercontent.com/Lightning-AI/litgpt/main/config_hub/finetune/llama-2-7b/lora.yaml ```
✅ 使用配置自定义训练 配置允许您自定义所有细粒度参数的训练,例如: ``` # 用于 finetuning 的 base model checkpoint 目录路径。(type: , default: checkpoints/stabilityai/stablelm-base-alpha-3b) checkpoint_dir: checkpoints/meta-llama/Llama-2-7b-hf # 保存 checkpoints 和 logs 的目录。(type: , default: out/lora) out_dir: out/finetune/qlora-llama2-7b # 用于 finetuning 的精度。可选选项:"bf16-true", "bf16-mixed", "32-true"。(type: Optional[str], default: null) precision: bf16-true ... ```
✅ 示例:LoRA 微调配置   ``` # 用于 finetuning 的 base model checkpoint 目录路径。(type: , default: checkpoints/stabilityai/stablelm-base-alpha-3b) checkpoint_dir: checkpoints/meta-llama/Llama-2-7b-hf # 保存 checkpoints 和 logs 的目录。(type: , default: out/lora) out_dir: out/finetune/qlora-llama2-7b # 用于 finetuning 的精度。可选选项:"bf16-true", "bf16-mixed", "32-true"。(type: Optional[str], default: null) precision: bf16-true # 如果设置,使用此算法对 model 进行 quantize。有关更多信息,请参见 ``tutorials/quantize.md``。(type: Optional[Literal['nf4', 'nf4-dq', 'fp4', 'fp4-dq', 'int8-training']], default: null) quantize: bnb.nf4 # 使用多少个 devices/GPUs。(type: Union[int, str], default: 1) devices: 1 # 使用多少个 nodes。(type: int, default: 1) num_nodes: 1 # LoRA rank。(type: int, default: 8) lora_r: 32 # LoRA alpha。(type: int, default: 16) lora_alpha: 16 # LoRA dropout 值。(type: float, default: 0.05) lora_dropout: 0.05 # 是否在 attention 中将 LoRA 应用于 query weights。(type: bool, default: True) lora_query: true # 是否在 attention 中将 LoRA 应用于 key weights。(type: bool, default: False) lora_key: false # 是否在 attention 中将 LoRA 应用于 value weights。(type: bool, default: True) lora_value: true # 是否在 attention block 的 output projection 中应用 LoRA。(type: bool, default: False) lora_projection: false # 是否在 attention block 中的 MLP weights 上应用 LoRA。(type: bool, default: False) lora_mlp: false # 是否在 GPT 中将 LoRA 应用于 output head。(type: bool, default: False) lora_head: false # Data 相关参数。如果未提供,默认值为 ``litgpt.data.Alpaca``。 data: class_path: litgpt.data.Alpaca2k init_args: mask_prompt: false val_split_fraction: 0.05 prompt_style: alpaca ignore_index: -100 seed: 42 num_workers: 4 download_dir: data/alpaca2k # Training 相关参数。详情请参见 ``litgpt.args.TrainArgs`` train: # Number of optimizer steps between saving checkpoints (type: Optional[int], default: 1000) save_interval: 200 # Number of iterations between logging calls (type: int, default: 1) log_interval: 1 # Number of samples between optimizer steps across data-parallel ranks (type: int, default: 128) global_batch_size: 8 # Number of samples per data-parallel rank (type: int, default: 4) micro_batch_size: 2 # Number of iterations with learning rate warmup active (type: int, default: 100) lr_warmup_steps: 10 # Number of epochs to train on (type: Optional[int], default: 5) epochs: 4 # Total number of tokens to train on (type: Optional[int], default: null) max_tokens: # Limits the number of optimizer steps to run (type: Optional[int], default: null) max_steps: # Limits the length of samples (type: Optional[int], default: null) max_seq_length: 512 # Whether to tie the embedding weights with the language modeling head weights (type: Optional[bool], default: null) tie_embeddings: # (type: float, default: 0.0003) learning_rate: 0.0002 # (type: float, default: 0.02) weight_decay: 0.0 # (type: float, default: 0.9) beta1: 0.9 # (type: float, default: 0.95) beta2: 0.95 # (type: Optional[float], default: null) max_norm: # (type: float, default: 6e-05) min_lr: 6.0e-05 # Evaluation 相关参数。详情请参见 ``litgpt.args.EvalArgs`` eval: # Number of optimizer steps between evaluation calls (type: int, default: 100) interval: 100 # Number of tokens to generate (type: Optional[int], default: 100) max_new_tokens: 100 # Number of iterations (type: int, default: 100) max_iters: 100 # 发送 metrics 的 logger 名称。(type: Literal['wandb', 'tensorboard', 'csv'], default: csv) logger_name: csv # 用于可重复性的 random seed。(type: int, default: 1337) seed: 1337 ```
✅ 在 CLI 中覆盖任何参数: ``` litgpt finetune \ --config https://raw.githubusercontent.com/Lightning-AI/litgpt/main/config_hub/finetune/llama-2-7b/lora.yaml \ --lora_r 4 ```
  # 项目亮点 LitGPT 为许多出色的 AI 项目、倡议、挑战赛以及当然还有企业提供了支持。请提交 pull request 以便考虑将其作为特色展示。
📊 SAMBA: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling 微软研究人员的 [Samba](https://github.com/microsoft/Samba) 项目建立在 LitGPT 代码库的基础之上,将状态空间模型与滑动窗口注意力机制结合起来,其表现优于纯状态空间模型。
🏆 NeurIPS 2023 Large Language Model Efficiency Challenge: 1 LLM + 1 GPU + 1 Day LitGPT 仓库是 [NeurIPS 2023 LLM Efficiency Challenge](https://llm-efficiency-challenge.github.io) 的官方入门套件,这是一项专注于在单个 GPU 上用 24 小时对现有的未经指令微调的 LLM 进行微调的比赛。
🦙 TinyLlama: An Open-Source Small Language Model LitGPT 为 [TinyLlama 项目](https://github.com/jzhang38/TinyLlama)和 [TinyLlama: An Open-Source Small Language Model](https://arxiv.org/abs/2401.02385) 研究论文提供了支持。
🍪 MicroLlama: MicroLlama-300M [MicroLlama](https://github.com/keeeeenw/MicroLlama) 是一个由 TinyLlama 和 LitGPT 提供支持的、在 50B token 上预训练的 300M Llama 模型。
🔬 Pre-training Small Base LMs with Fewer Tokens 利用 LitGPT 的研究论文 [Pre-training Small Base LMs with Fewer Tokens](https://arxiv.org/abs/2404.08634) 通过从较大的模型中继承几个 transformer 块,并在较大模型使用的一小部分数据上进行训练,开发了更小的基础语言模型。它表明,尽管使用的训练数据和资源少得多,但这些较小的模型可以表现出与较大模型相当的性能。
  # 社区 我们欢迎所有个人贡献者,无论其经验或硬件水平如何。您的贡献非常宝贵,我们很高兴看到您在这个协作和支持的环境中能取得怎样的成就。 - [申请功能](https://github.com/Lightning-AI/litgpt/issues) - [提交您的第一个贡献](https://lightning.ai/pages/community/tutorial/how-to-contribute-to-litgpt/) - [加入我们的 Discord](https://discord.gg/VptPCZkGNa)   # 教程 🚀 [开始使用](tutorials/0_to_litgpt.md)
⚡️ [微调,包含 LoRA、QLoRA 和 Adapter](tutorials/finetune.md)
🤖 [预训练](tutorials/pretrain.md)
💬 [模型评估](tutorials/evaluation.md)
📘 [支持的数据集和自定义数据集](tutorials/prepare_dataset.md)
🧹 [量化](tutorials/quantize.md)
🤯 [处理内存不足 (OOM) 错误的技巧](tutorials/oom.md)
🧑🏽‍💻 [使用云 TPU](extensions/xla)
  ### 致谢 此实现扩展了 [Lit-LLaMA](https://github.com/lightning-AI/lit-llama) 和 [nanoGPT](https://github.com/karpathy/nanoGPT),并且**由 [Lightning Fabric](https://lightning.ai/docs/fabric/stable/) ⚡ 提供支持**。 - [@karpathy](https://github.com/karpathy) 感谢其 [nanoGPT](https://github.com/karpathy/nanoGPT) - [@EleutherAI](https://github.com/EleutherAI) 感谢其 [GPT-NeoX](https://github.com/EleutherAI/gpt-neox) 和 [Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) - [@TimDettmers](https://github.com/TimDettmers) 感谢其 [bitsandbytes](https://github.com/TimDettmers/bitsandbytes) - [@Microsoft](https://github.com/microsoft) 感谢其 [LoRA](https://github.com/microsoft/LoRA) - [@tridao](https://github.com/tridao) 感谢其 [Flash Attention 2](https://github.com/Dao-AILab/flash-attention) ### 许可证 LitGPT 采用 [Apache 2.0](https://github.com/Lightning-AI/litgpt/blob/main/LICENSE.md) 许可证发布。 ### 引用 如果您在研究中使用 LitGPT,请引用以下工作: ``` @misc{litgpt-2023, author = {Lightning AI}, title = {LitGPT}, howpublished = {\url{https://github.com/Lightning-AI/litgpt}}, year = {2023}, } ```  
标签:DLL 劫持, PyTorch, 人工智能, 凭据扫描, 大语言模型, 模型微调, 模型训练, 深度学习, 用户模式Hook绕过, 逆向工具