litgpt 0.3.0__tar.gz → 0.4.0.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/PKG-INFO +94 -86
  2. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/README.md +88 -81
  3. litgpt-0.4.0.dev0/litgpt/__main__.py +61 -0
  4. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/args.py +2 -4
  5. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/chat/base.py +111 -38
  6. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/config.py +61 -4
  7. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/__init__.py +2 -0
  8. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/lit_data.py +5 -1
  9. litgpt-0.4.0.dev0/litgpt/data/microllama.py +13 -0
  10. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/prepare_slimpajama.py +4 -2
  11. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/prepare_starcoder.py +4 -1
  12. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/tinyllama.py +34 -21
  13. litgpt-0.4.0.dev0/litgpt/deploy/serve.py +244 -0
  14. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/eval/evaluate.py +18 -24
  15. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/finetune/adapter.py +18 -21
  16. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/finetune/adapter_v2.py +18 -21
  17. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/finetune/full.py +17 -16
  18. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/finetune/lora.py +18 -21
  19. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/generate/adapter.py +31 -11
  20. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/generate/adapter_v2.py +31 -11
  21. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/generate/base.py +79 -18
  22. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/generate/full.py +31 -11
  23. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/generate/sequentially.py +30 -11
  24. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/generate/tp.py +29 -10
  25. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/lora.py +31 -32
  26. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/pretrain.py +50 -33
  27. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/prompts.py +9 -0
  28. litgpt-0.4.0.dev0/litgpt/scripts/__init__.py +0 -0
  29. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/scripts/convert_hf_checkpoint.py +11 -8
  30. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/scripts/convert_lit_checkpoint.py +9 -5
  31. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/scripts/convert_pretrained_checkpoint.py +8 -6
  32. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/scripts/download.py +26 -16
  33. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/scripts/merge_lora.py +22 -11
  34. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/utils.py +56 -11
  35. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt.egg-info/PKG-INFO +94 -86
  36. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt.egg-info/SOURCES.txt +3 -0
  37. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt.egg-info/requires.txt +5 -4
  38. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/pyproject.toml +7 -6
  39. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_adapter.py +5 -5
  40. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_adapter_v2.py +5 -5
  41. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_chat.py +7 -12
  42. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_ci.py +1 -1
  43. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_cli.py +7 -4
  44. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_config.py +24 -3
  45. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_config_hub.py +1 -1
  46. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_convert_lit_checkpoint.py +1 -3
  47. litgpt-0.4.0.dev0/tests/test_evaluate.py +47 -0
  48. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_full.py +5 -5
  49. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_generate.py +30 -14
  50. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_generate_adapter.py +11 -12
  51. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_generate_sequentially.py +7 -14
  52. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_generate_tp.py +8 -13
  53. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_lora.py +44 -9
  54. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_model.py +1 -3
  55. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_pretrain.py +3 -9
  56. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_prompts.py +1 -1
  57. litgpt-0.4.0.dev0/tests/test_readme.py +175 -0
  58. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_thunder_ddp.py +19 -6
  59. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_thunder_fsdp.py +1 -19
  60. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_thunder_pretrain.py +2 -1
  61. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_unsloth_executor.py +1 -1
  62. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_utils.py +106 -12
  63. litgpt-0.3.0/litgpt/__main__.py +0 -147
  64. litgpt-0.3.0/litgpt/deploy/serve.py +0 -138
  65. litgpt-0.3.0/tests/test_evaluate.py +0 -64
  66. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/LICENSE +0 -0
  67. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/__init__.py +0 -0
  68. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/adapter.py +0 -0
  69. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/adapter_v2.py +0 -0
  70. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/chat/__init__.py +0 -0
  71. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/alpaca.py +0 -0
  72. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/alpaca_2k.py +0 -0
  73. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/alpaca_gpt4.py +0 -0
  74. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/base.py +0 -0
  75. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/deita.py +0 -0
  76. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/dolly.py +0 -0
  77. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/flan.py +0 -0
  78. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/json_data.py +0 -0
  79. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/lima.py +0 -0
  80. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/longform.py +0 -0
  81. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/openwebtext.py +0 -0
  82. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/text_files.py +0 -0
  83. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/data/tinystories.py +0 -0
  84. {litgpt-0.3.0/litgpt/finetune → litgpt-0.4.0.dev0/litgpt/deploy}/__init__.py +0 -0
  85. {litgpt-0.3.0/litgpt/generate → litgpt-0.4.0.dev0/litgpt/finetune}/__init__.py +0 -0
  86. {litgpt-0.3.0/litgpt/scripts → litgpt-0.4.0.dev0/litgpt/generate}/__init__.py +0 -0
  87. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/model.py +0 -0
  88. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt/tokenizer.py +0 -0
  89. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt.egg-info/dependency_links.txt +0 -0
  90. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt.egg-info/entry_points.txt +0 -0
  91. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/litgpt.egg-info/top_level.txt +0 -0
  92. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/setup.cfg +0 -0
  93. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_args.py +0 -0
  94. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_convert_hf_checkpoint.py +0 -0
  95. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_convert_pretrained_checkpoint.py +0 -0
  96. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_merge_lora.py +0 -0
  97. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_rope.py +0 -0
  98. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_serve.py +0 -0
  99. {litgpt-0.3.0 → litgpt-0.4.0.dev0}/tests/test_tokenizer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: litgpt
3
- Version: 0.3.0
3
+ Version: 0.4.0.dev0
4
4
  Summary: Hackable implementation of state-of-the-art open-source LLMs
5
5
  Author-email: Lightning AI <contact@lightning.ai>
6
6
  License: Apache License
@@ -210,23 +210,24 @@ Project-URL: documentation, https://github.com/lightning-AI/litgpt/tutorials
210
210
  Description-Content-Type: text/markdown
211
211
  License-File: LICENSE
212
212
  Requires-Dist: torch>=2.2.0
213
- Requires-Dist: lightning==2.3.0.dev20240328
213
+ Requires-Dist: lightning==2.3.0.dev20240428
214
214
  Requires-Dist: jsonargparse[signatures]>=4.27.6
215
- Requires-Dist: litserve>=0.1.0
216
215
  Provides-Extra: test
217
216
  Requires-Dist: pytest>=8.1.1; extra == "test"
218
217
  Requires-Dist: pytest-rerunfailures>=14.0; extra == "test"
219
218
  Requires-Dist: pytest-timeout>=2.3.1; extra == "test"
219
+ Requires-Dist: pytest-dependency>=0.6.0; extra == "test"
220
220
  Requires-Dist: transformers>=4.38.0; extra == "test"
221
221
  Requires-Dist: einops>=0.7.0; extra == "test"
222
222
  Requires-Dist: protobuf>=4.23.4; extra == "test"
223
- Requires-Dist: lightning-thunder==0.2.0.dev20240404; python_version >= "3.10" and extra == "test"
223
+ Requires-Dist: lightning-thunder==0.2.0.dev20240505; python_version >= "3.10" and extra == "test"
224
224
  Provides-Extra: all
225
225
  Requires-Dist: bitsandbytes==0.42.0; extra == "all"
226
226
  Requires-Dist: sentencepiece>=0.2.0; extra == "all"
227
227
  Requires-Dist: tokenizers>=0.15.2; extra == "all"
228
228
  Requires-Dist: requests>=2.31.0; extra == "all"
229
- Requires-Dist: litdata>=0.2.2; extra == "all"
229
+ Requires-Dist: litdata==0.2.6; extra == "all"
230
+ Requires-Dist: litserve==0.1.1dev0; extra == "all"
230
231
  Requires-Dist: zstandard>=0.22.0; extra == "all"
231
232
  Requires-Dist: pandas>=1.9.0; extra == "all"
232
233
  Requires-Dist: pyarrow>=15.0.2; extra == "all"
@@ -247,7 +248,11 @@ Requires-Dist: huggingface_hub[hf_transfer]>=0.21.0; extra == "all"
247
248
 
248
249
  Uses the latest state-of-the-art techniques:
249
250
 
250
- ✅ flash attention &nbsp; &nbsp; ✅ fp4/8/16/32 &nbsp; &nbsp; ✅ LoRA, QLoRA, Adapter (v1, v2) &nbsp; &nbsp; ✅ FSDP &nbsp; &nbsp; ✅ 1-1000+ GPUs/TPUs
251
+ <pre>
252
+ ✅ flash attention ✅ fp4/8/16/32 ✅ LoRA, QLoRA, Adapter
253
+ ✅ FSDP ✅ 1-1000+ GPUs/TPUs ✅ 20+ LLMs
254
+ </pre>
255
+
251
256
 
252
257
  ---
253
258
 
@@ -273,63 +278,70 @@ Uses the latest state-of-the-art techniques:
273
278
  <img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/GithubLitGPTDAG2.png" alt="LitGPT steps" width="auto"/>
274
279
  &nbsp;
275
280
 
276
- # Finetune, pretrain and deploy LLMs Lightning fast ⚡⚡
281
+ # Finetune, pretrain and deploy LLMs Lightning fast ⚡⚡
277
282
  LitGPT is a command-line tool designed to easily [finetune](#finetune-an-llm), [pretrain](#pretrain-an-llm), [evaluate](#use-an-llm), and [deploy](#deploy-an-llm) [20+ LLMs](#choose-from-20-llms) **on your own data**. It features highly-optimized [training recipes](#training-recipes) for the world's most powerful open-source large language models (LLMs).
278
283
 
279
- We reimplemented all model architectures and training recipes from scratch for 4 reasons:
284
+ We reimplemented all model architectures and training recipes from scratch for 4 reasons:
280
285
 
281
- 1. Remove all abstraction layers and have single file implementations.
282
- 2. Guarantee Apache 2.0 compliance to enable enterprise use without limits.
283
- 3. Optimized each model's architectural detail to maximize performance, reduce costs, and speed up training.
284
- 4. Highly-optimized [recipe configs](#training-recipes) we have tested at enterprise scale.
286
+ 1. Remove all abstraction layers and have single file implementations.
287
+ 2. Guarantee Apache 2.0 compliance to enable enterprise use without limits.
288
+ 3. Optimized each model's architectural detail to maximize performance, reduce costs, and speed up training.
289
+ 4. Highly-optimized [recipe configs](#training-recipes) we have tested at enterprise scale.
285
290
 
286
291
  ---
287
292
 
288
293
  &nbsp;
289
294
 
290
295
  # Choose from 20+ LLMs
291
- LitGPT has 🤯 **custom, from-scratch implementations** of [20+ LLMs](tutorials/download_model_weights.md) without layers of abstraction:
296
+ LitGPT has 🤯 **custom, from-scratch implementations** of [20+ LLMs](tutorials/download_model_weights.md) without layers of abstraction:
292
297
 
293
298
  | Model | Model size | Author | Reference |
294
299
  |----|----|----|----|
295
- | Llama 3 | 8B, 70B | Meta AI | [Meta AI 2024](https://github.com/meta-llama/llama3) |
296
- | Llama 2 | 7B, 13B, 70B | Meta AI | [Touvron et al. 2023](https://arxiv.org/abs/2307.09288) |
300
+ | Llama 3 | 8B, 70B | Meta AI | [Meta AI 2024](https://github.com/meta-llama/llama3) |
301
+ | Llama 2 | 7B, 13B, 70B | Meta AI | [Touvron et al. 2023](https://arxiv.org/abs/2307.09288) |
297
302
  | Code Llama | 7B, 13B, 34B, 70B | Meta AI | [Rozière et al. 2023](https://arxiv.org/abs/2308.12950) |
298
- | Mistral | 7B | Mistral AI | [Mistral website](https://mistral.ai/) |
303
+ | Mixtral MoE | 8x7B | Mistral AI | [Mistral AI 2023](https://mistral.ai/news/mixtral-of-experts/) |
304
+ | Mistral | 7B | Mistral AI | [Mistral AI 2023](https://mistral.ai/news/announcing-mistral-7b/) |
299
305
  | CodeGemma | 7B | Google | [Google Team, Google Deepmind](https://ai.google.dev/gemma/docs/codegemma) |
300
306
  | ... | ... | ... | ... |
301
307
 
302
308
  <details>
303
309
  <summary>See full list of 20+ LLMs</summary>
304
310
 
305
- &nbsp;
311
+ &nbsp;
306
312
 
307
313
  #### All models
308
-
314
+
309
315
  | Model | Model size | Author | Reference |
310
316
  |----|----|----|----|
311
- | CodeGemma | 7B | Google | [Google Team, Google Deepmind](https://ai.google.dev/gemma/docs/codegemma) |
312
- | Code Llama | 7B, 13B, 34B, 70B | Meta AI | [Rozière et al. 2023](https://arxiv.org/abs/2308.12950) |
313
- | Dolly | 3B, 7B, 12B | Databricks | [Conover et al. 2023](https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm) |
314
- | Falcon | 7B, 40B, 180B | TII UAE | [TII 2023](https://falconllm.tii.ae) |
315
- | FreeWilly2 (Stable Beluga 2) | 70B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stable-beluga-large-instruction-fine-tuned-models) |
316
- | Function Calling Llama 2 | 7B | Trelis | [Trelis et al. 2023](https://huggingface.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2) |
317
- | Gemma | 2B, 7B | Google | [Google Team, Google Deepmind](https://storage.googleapis.com/deepmind-media/gemma/gemma-report.pdf) |
318
- | Llama 2 | 7B, 13B, 70B | Meta AI | [Touvron et al. 2023](https://arxiv.org/abs/2307.09288) |
319
- | Llama 3 | 8B, 70B | Meta AI | [Meta AI 2024](https://github.com/meta-llama/llama3) |
320
- | LongChat | 7B, 13B | LMSYS | [LongChat Team 2023](https://lmsys.org/blog/2023-06-29-longchat/) |
321
- | Mistral | 7B | Mistral AI | [Mistral website](https://mistral.ai/) |
322
- | Nous-Hermes | 7B, 13B, 70B | NousResearch | [Org page](https://huggingface.co/NousResearch) |
323
- | OpenLLaMA | 3B, 7B, 13B | OpenLM Research | [Geng & Liu 2023](https://github.com/openlm-research/open_llama) |
324
- | Phi | 1.3B, 2.7B | Microsoft Research | [Li et al. 2023](https://arxiv.org/abs/2309.05463) |
317
+ | CodeGemma | 7B | Google | [Google Team, Google Deepmind](https://ai.google.dev/gemma/docs/codegemma) |
318
+ | Code Llama | 7B, 13B, 34B, 70B | Meta AI | [Rozière et al. 2023](https://arxiv.org/abs/2308.12950) |
319
+ | Danube2 | 1.8B | H2O.ai | [H2O.ai](https://h2o.ai/platform/danube-1-8b/) |
320
+ | Dolly | 3B, 7B, 12B | Databricks | [Conover et al. 2023](https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm) |
321
+ | Falcon | 7B, 40B, 180B | TII UAE | [TII 2023](https://falconllm.tii.ae) |
322
+ | FreeWilly2 (Stable Beluga 2) | 70B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stable-beluga-large-instruction-fine-tuned-models) |
323
+ | Function Calling Llama 2 | 7B | Trelis | [Trelis et al. 2023](https://huggingface.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2) |
324
+ | Gemma | 2B, 7B | Google | [Google Team, Google Deepmind](https://storage.googleapis.com/deepmind-media/gemma/gemma-report.pdf) |
325
+ | Llama 2 | 7B, 13B, 70B | Meta AI | [Touvron et al. 2023](https://arxiv.org/abs/2307.09288) |
326
+ | Llama 3 | 8B, 70B | Meta AI | [Meta AI 2024](https://github.com/meta-llama/llama3) |
327
+ | LongChat | 7B, 13B | LMSYS | [LongChat Team 2023](https://lmsys.org/blog/2023-06-29-longchat/) |
328
+ | MicroLlama | 300M | Ken Wang | [MicroLlama repo](https://github.com/keeeeenw/MicroLlama)
329
+ | Mixtral MoE | 8x7B | Mistral AI | [Mistral AI 2023](https://mistral.ai/news/mixtral-of-experts/) |
330
+ | Mistral | 7B | Mistral AI | [Mistral AI 2023](https://mistral.ai/news/announcing-mistral-7b/) |
331
+ | Nous-Hermes | 7B, 13B, 70B | NousResearch | [Org page](https://huggingface.co/NousResearch) |
332
+ | OpenLLaMA | 3B, 7B, 13B | OpenLM Research | [Geng & Liu 2023](https://github.com/openlm-research/open_llama) |
333
+ | Phi | 1.3B, 2.7B | Microsoft Research | [Li et al. 2023](https://arxiv.org/abs/2309.05463) |
325
334
  | Platypus | 7B, 13B, 70B | Lee et al. | [Lee, Hunter, and Ruiz 2023](https://arxiv.org/abs/2308.07317) |
326
- | 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) |
327
- | RedPajama-INCITE | 3B, 7B | Together | [Together 2023](https://together.ai/blog/redpajama-models-v1) |
328
- | StableCode | 3B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stablecode-llm-generative-ai-coding) |
329
- | StableLM | 3B, 7B | Stability AI | [Stability AI 2023](https://github.com/Stability-AI/StableLM) |
330
- | StableLM Zephyr | 3B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stablecode-llm-generative-ai-coding) |
331
- | TinyLlama | 1.1B | Zhang et al. | [Zhang et al. 2023](https://github.com/jzhang38/TinyLlama) |
332
- | Vicuna | 7B, 13B, 33B | LMSYS | [Li et al. 2023](https://lmsys.org/blog/2023-03-30-vicuna/)
335
+ | 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) |
336
+ | RedPajama-INCITE | 3B, 7B | Together | [Together 2023](https://together.ai/blog/redpajama-models-v1) |
337
+ | StableCode | 3B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stablecode-llm-generative-ai-coding) |
338
+ | StableLM | 3B, 7B | Stability AI | [Stability AI 2023](https://github.com/Stability-AI/StableLM) |
339
+ | StableLM Zephyr | 3B | Stability AI | [Stability AI 2023](https://stability.ai/blog/stablecode-llm-generative-ai-coding) |
340
+ | TinyLlama | 1.1B | Zhang et al. | [Zhang et al. 2023](https://github.com/jzhang38/TinyLlama) |
341
+ | Vicuna | 7B, 13B, 33B | LMSYS | [Li et al. 2023](https://lmsys.org/blog/2023-03-30-vicuna/) |
342
+
343
+ **Tip**: You can list all available models by running the `litgpt download list` command.
344
+
333
345
 
334
346
  </details>
335
347
 
@@ -361,41 +373,44 @@ pip install -e '.[all]'
361
373
 
362
374
  &nbsp;
363
375
  # Quick start
364
- After installing LitGPT, select the model and action you want to take on that model (finetune, pretrain, evaluate, deploy, etc...):
376
+ After installing LitGPT, select the model and action you want to take on that model (finetune, pretrain, evaluate, deploy, etc...):
365
377
 
366
378
  ```bash
367
379
  # ligpt [action] [model]
368
380
  litgpt download meta-llama/Meta-Llama-3-8B-Instruct
369
381
  litgpt chat meta-llama/Meta-Llama-3-8B-Instruct
370
- litgpt finetune meta-llama/Meta-Llama-3-8B-Instruct
371
- litgpt pretrain meta-llama/Meta-Llama-3-8B-Instruct
372
- litgpt serve meta-llama/Meta-Llama-3-8B-Instruct
382
+ litgpt finetune meta-llama/Meta-Llama-3-8B-Instruct
383
+ litgpt pretrain meta-llama/Meta-Llama-3-8B-Instruct
384
+ litgpt serve meta-llama/Meta-Llama-3-8B-Instruct
373
385
  ```
374
386
 
375
387
  &nbsp;
376
388
 
377
389
  ### Use an LLM for inference
378
- Use LLMs for inference to test its chatting capabilities, run evaluations, or extract embeddings, etc...
379
- Here's an example showing how to use the Mistral 7B LLM.
390
+ Use LLMs for inference to test its chatting capabilities, run evaluations, or extract embeddings, etc.
391
+ Here's an example showing how to use the Phi-2 LLM.
380
392
 
381
393
  <a target="_blank" href="https://lightning.ai/lightning-ai/studios/litgpt-chat">
382
394
  <img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/>
383
395
  </a>
384
396
 
385
- &nbsp;
397
+ &nbsp;
386
398
 
387
399
  ```bash
388
- # 1) Download a pretrained model
389
- litgpt download --repo_id mistralai/Mistral-7B-Instruct-v0.2
400
+ # 1) List all available models in litgpt
401
+ litgpt download list
402
+
403
+ # 2) Download a pretrained model
404
+ litgpt download microsoft/phi-2
390
405
 
391
- # 2) Chat with the model
392
- litgpt chat \
393
- --checkpoint_dir checkpoints/mistralai/Mistral-7B-Instruct-v0.2
406
+ # 3) Chat with the model
407
+ litgpt chat microsoft/phi-2
394
408
 
395
409
  >> Prompt: What do Llamas eat?
396
410
  ```
397
411
 
398
- For more information, refer to the [download](tutorials/download_model_weights.md) and [inference](tutorials/inference.md) tutorials.
412
+ The download of certain models requires an additional access token. You can read more about this in the [download](tutorials/download_model_weights.md#specific-models-and-access-tokens) documentation.
413
+ For more information on the different inference options, refer to the [inference](tutorials/inference.md) tutorial.
399
414
 
400
415
  &nbsp;
401
416
 
@@ -406,37 +421,35 @@ For more information, refer to the [download](tutorials/download_model_weights.m
406
421
  <img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/>
407
422
  </a>
408
423
 
409
- &nbsp;
424
+ &nbsp;
410
425
 
411
426
  ```bash
412
427
  # 1) Download a pretrained model
413
- litgpt download --repo_id microsoft/phi-2
428
+ litgpt download microsoft/phi-2
414
429
 
415
430
  # 2) Finetune the model
416
431
  curl -L https://huggingface.co/datasets/ksaw008/finance_alpaca/resolve/main/finance_alpaca.json -o my_custom_dataset.json
417
432
 
418
- litgpt finetune \
419
- --checkpoint_dir checkpoints/microsoft/phi-2 \
433
+ litgpt finetune microsoft/phi-2 \
420
434
  --data JSON \
421
435
  --data.json_path my_custom_dataset.json \
422
436
  --data.val_split_fraction 0.1 \
423
437
  --out_dir out/custom-model
424
438
 
425
439
  # 3) Chat with the model
426
- litgpt chat \
427
- --checkpoint_dir out/custom-model/final
440
+ litgpt chat out/custom-model/final
428
441
  ```
429
442
 
430
443
  &nbsp;
431
444
 
432
- ### Pretrain an LLM
445
+ ### Pretrain an LLM
433
446
  Train an LLM from scratch on your own data via pretraining:
434
447
 
435
448
  <a target="_blank" href="https://lightning.ai/lightning-ai/studios/litgpt-pretrain">
436
449
  <img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg"; alt="Open In Studio"/>
437
450
  </a>
438
451
 
439
- &nbsp;
452
+ &nbsp;
440
453
 
441
454
  ```bash
442
455
  mkdir -p custom_texts
@@ -444,35 +457,32 @@ curl https://www.gutenberg.org/cache/epub/24440/pg24440.txt --output custom_text
444
457
  curl https://www.gutenberg.org/cache/epub/26393/pg26393.txt --output custom_texts/book2.txt
445
458
 
446
459
  # 1) Download a tokenizer
447
- litgpt download \
448
- --repo_id EleutherAI/pythia-160m \
460
+ litgpt download EleutherAI/pythia-160m \
449
461
  --tokenizer_only True
450
462
 
451
463
  # 2) Pretrain the model
452
- litgpt pretrain \
453
- --model_name pythia-160m \
454
- --tokenizer_dir checkpoints/EleutherAI/pythia-160m \
464
+ litgpt pretrain EleutherAI/pythia-160m \
465
+ --tokenizer_dir EleutherAI/pythia-160m \
455
466
  --data TextFiles \
456
467
  --data.train_data_path "custom_texts/" \
457
468
  --train.max_tokens 10_000_000 \
458
469
  --out_dir out/custom-model
459
470
 
460
471
  # 3) Chat with the model
461
- litgpt chat \
462
- --checkpoint_dir out/custom-model/final
472
+ litgpt chat out/custom-model/final
463
473
  ```
464
474
 
465
475
  &nbsp;
466
476
 
467
- ### Continue pretraining an LLM
468
- This is another way of finetuning that specializes an already pretrained model by training on custom data:
477
+ ### Continue pretraining an LLM
478
+ This is another way of finetuning that specializes an already pretrained model by training on custom data:
469
479
 
470
480
 
471
481
  <a target="_blank" href="https://lightning.ai/lightning-ai/studios/litgpt-continue-pretraining">
472
482
  <img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg"; alt="Open In Studio"/>
473
483
  </a>
474
484
 
475
- &nbsp;
485
+ &nbsp;
476
486
 
477
487
  ```bash
478
488
  mkdir -p custom_texts
@@ -480,27 +490,25 @@ curl https://www.gutenberg.org/cache/epub/24440/pg24440.txt --output custom_text
480
490
  curl https://www.gutenberg.org/cache/epub/26393/pg26393.txt --output custom_texts/book2.txt
481
491
 
482
492
  # 1) Download a pretrained model
483
- litgpt download --repo_id EleutherAI/pythia-160m
493
+ litgpt download EleutherAI/pythia-160m
484
494
 
485
495
  # 2) Continue pretraining the model
486
- litgpt pretrain \
487
- --model_name pythia-160m \
488
- --tokenizer_dir checkpoints/EleutherAI/pythia-160m \
489
- --initial_checkpoint_dir checkpoints/EleutherAI/pythia-160m \
496
+ litgpt pretrain EleutherAI/pythia-160m \
497
+ --tokenizer_dir EleutherAI/pythia-160m \
498
+ --initial_checkpoint_dir EleutherAI/pythia-160m \
490
499
  --data TextFiles \
491
500
  --data.train_data_path "custom_texts/" \
492
501
  --train.max_tokens 10_000_000 \
493
502
  --out_dir out/custom-model
494
503
 
495
504
  # 3) Chat with the model
496
- litgpt chat \
497
- --checkpoint_dir out/custom-model/final
505
+ litgpt chat out/custom-model/final
498
506
  ```
499
507
 
500
508
  &nbsp;
501
509
 
502
510
  ### Deploy an LLM
503
- Once you're ready to deploy a finetuned LLM, run this command:
511
+ Once you're ready to deploy a finetuned LLM, run this command:
504
512
 
505
513
  <a target="_blank" href="https://lightning.ai/lightning-ai/studios/litgpt-serve">
506
514
  <img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/>
@@ -509,20 +517,20 @@ Once you're ready to deploy a finetuned LLM, run this command:
509
517
  &nbsp;
510
518
 
511
519
  ```bash
512
- # locate the checkpoint to your finetuned or pretrained model and call the `serve` command:
513
- litgpt serve --checkpoint_dir path/to/your/checkpoint/microsoft/phi-2
520
+ # locate the checkpoint to your finetuned or pretrained model and call the `serve` command:
521
+ litgpt serve microsoft/phi-2
514
522
 
515
- # Alternative: if you haven't finetuned, download any checkpoint to deploy it:
516
- litgpt download --repo_id microsoft/phi-2
517
- litgpt serve --checkpoint_dir checkpoints/microsoft/phi-2
523
+ # Alternative: if you haven't finetuned, download any checkpoint to deploy it:
524
+ litgpt download microsoft/phi-2
525
+ litgpt serve microsoft/phi-2
518
526
  ```
519
527
 
520
- Test the server in a separate terminal and integrate the model API into your AI product:
528
+ Test the server in a separate terminal and integrate the model API into your AI product:
521
529
  ```python
522
530
  # 3) Use the server (in a separate session)
523
531
  import requests, json
524
532
  response = requests.post(
525
- "http://127.0.0.1:8000/predict",
533
+ "http://127.0.0.1:8000/predict",
526
534
  json={"prompt": "Fix typos in the following sentence: Exampel input"}
527
535
  )
528
536
  print(response.json()["output"])
@@ -731,7 +739,7 @@ litgpt finetune \
731
739
 
732
740
  &nbsp;
733
741
 
734
- # Community
742
+ # Community
735
743
 
736
744
  ## Get involved!
737
745