Skip to content

Commit

Permalink
Merge branch 'main' into multiline
Browse files Browse the repository at this point in the history
  • Loading branch information
lantiga authored Apr 16, 2024
2 parents 74f33d2 + 02b04ba commit 4b91010
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 55 deletions.
1 change: 1 addition & 0 deletions .github/azure-gpu-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
displayName: "Image info & NVIDIA"
- script: |
pip install --upgrade pip
pip install '.[all,test]'
displayName: 'Install dependencies'
Expand Down
37 changes: 15 additions & 22 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check Markdown Links
name: Check hyperlinks

on:
push:
Expand All @@ -9,30 +9,23 @@ on:
- main

jobs:
check-links:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Markdown Link Checker
run: npm install -g markdown-link-check
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Create config for markdown link checker
run: |
echo '{
"projectBaseUrl":"${{ github.workspace }}",
"ignorePatterns": [
{
"pattern": "^#"
},
{
"pattern": "^https://falconllm.tii.ae"
}
]
}' > $GITHUB_WORKSPACE/md_checker_config.json
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-check-links
- name: Find Markdown Files and Check Links
run: |
find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check -c $GITHUB_WORKSPACE/md_checker_config.json
- name: Check links
run: |
pytest --check-links README.md --check-links-ignore "https://stability.ai/blog/stablecode-llm-generative-ai-coding"
pytest --check-links tutorials --check-links-ignore "https://stability.ai/blog/stablecode-llm-generative-ai-coding"
1 change: 1 addition & 0 deletions .github/workflows/cpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- name: Install minimal dependencies
run: |
pip install --upgrade pip
pip install .
pip list
# make sure all modules are still importable with only the minimal dependencies available
Expand Down
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# ⚡ LitGPT

**Pretrain, finetune, deploy 20+ LLMs on your own data**
**Pretrain, finetune, evaluate, and deploy 20+ LLMs on your own data**

Uses the latest state-of-the-art techniques:

✅ fp4/8/16/32     ✅ LoRA, QLoRA, Adapter (v1, v2)     ✅ flash attention     ✅ FSDP     ✅ 1-1000+ GPUs/TPUs
flash attention    fp4/8/16/32     ✅ LoRA, QLoRA, Adapter (v1, v2)     ✅ FSDP     ✅ 1-1000+ GPUs/TPUs

---

Expand All @@ -32,14 +32,15 @@ Uses the latest state-of-the-art techniques:

 

## Finetune, pretrain and deploy AI models Lightning fast ⚡⚡
LitGPT is a command-line tool to use, pretrain, finetune and deploy LLMs. It is based on configs with highly-optimized recipes for training the world's largest, most powerful open-source LLMs.
# Finetune, pretrain and deploy LLMs Lightning fast ⚡⚡
LitGPT is a command-line tool designed to easily [finetune](#finetune-an-llm), [pretrain](#pretrain-an-llm), [evaluate](#use-an-llm), and deploy [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).

We've reimplemented all the model architectures and training recipes for 3 reasons:
We reimplemented all model architectures and training recipes from scratch for 4 reasons:

1. Remove all abstraction layers and have single file implementations.
2. Guarantee Apache 2.0 compliance to enable enterprise use without limits.
3. Optimized every detail of every model to get the fastest performance possible to lower cost and training speeds.
1. Remove all abstraction layers and have single file implementations.
2. Guarantee Apache 2.0 compliance to enable enterprise use without limits.
3. Optimized each model architectural detail to maximize performance, reduce costs, and speed up training.
4. Highly-optimized [recipe configs](#training-recipes) we have tested at enterprise scale.

 

Expand Down Expand Up @@ -70,7 +71,16 @@ pip install -e '.[all]'
---

# Get started
LitGPT is CLI and config-based. Select the model and the action you want to take on that model (finetune, pretrain, evaluate, deploy, etc...):
After installing LitGPT, select the model and action you want to take on that model (finetune, pretrain, evaluate, deploy, etc...):

```bash
# ligpt [action] [model]
litgpt download mistralai/Mistral-7B-Instruct-v0.2
litgpt chat mistralai/Mistral-7B-Instruct-v0.2
litgpt finetune mistralai/Mistral-7B-Instruct-v0.2
litgpt pretrain mistralai/Mistral-7B-Instruct-v0.2
litgpt serve mistralai/Mistral-7B-Instruct-v0.2
```

 

Expand Down Expand Up @@ -230,9 +240,9 @@ Use, Finetune, pretrain, deploy over 20+ LLMs ([full list](tutorials/download_mo

# Training recipes

LitGPT comes with validated recipes (YAML configs) to train models under different conditions.
LitGPT comes with validated recipes (YAML configs) to train models under different conditions. We've generated these recipes based on the parameters we found to perform the best for different training conditions.

We've generated these recipes based on the parameters we found to perform the best for different training conditions.
Browse all training recipes [here](config_hub).

### Example

Expand All @@ -241,8 +251,6 @@ litgpt finetune lora \
--config https://raw.githubusercontent.com/Lightning-AI/litgpt/main/config_hub/finetune/llama-2-7b/lora.yaml
```

Browse all training recipes [here](config_hub).

### What is a config
Configs let you customize training for all granular parameters like:

Expand Down Expand Up @@ -401,6 +409,8 @@ litgpt finetune lora \

 

# Community

## Get involved!

We appreciate your feedback and contributions. If you have feature requests, questions, or want to contribute code or config files, please don't hesitate to use the [GitHub Issue](https://github.com/Lightning-AI/litgpt/issues) tracker.
Expand Down
2 changes: 1 addition & 1 deletion litgpt/scripts/convert_lit_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def check_conversion_supported(lit_weights: Dict[str, torch.Tensor]) -> None:
if any("lora" in wn for wn in lit_weights):
raise ValueError("Checkpoints with LoRA weights cannot be converted. Call `scripts/merge_lora.py` first.")
if any("adapter" in wn or "gating_factor" in wn for wn in lit_weights):
raise NotImplementedError("Converting adapter models is supported.")
raise NotImplementedError("Converting adapter models is not supported.")


@torch.inference_mode()
Expand Down
36 changes: 18 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@ litgpt = "litgpt.__main__:main"

[project.optional-dependencies]
test = [
"pytest",
"pytest-rerunfailures",
"pytest-timeout",
"pytest>=8.1.1",
"pytest-rerunfailures>=14.0",
"pytest-timeout>=2.3.1",
"transformers>=4.38.0", # numerical comparisons
"einops",
"protobuf",
"einops>=0.7.0",
"protobuf>=4.23.4",
"lightning-thunder==0.2.0.dev20240404; python_version >= '3.10'",
]
all = [
"bitsandbytes==0.42.0", # quantization
"sentencepiece", # llama-based models
"tokenizers", # pythia, falcon, redpajama
"requests", # litgpt.data
"litdata", # litgpt.data
"zstandard", # litgpt.data.prepare_slimpajama.py
"pandas", # litgpt.data.prepare_starcoder.py
"pyarrow", # litgpt.data.prepare_starcoder.py
"tensorboard", # litgpt.pretrain
"torchmetrics", # litgpt.pretrain
"datasets", # litgpt.evaluate
"sentencepiece>=0.2.0", # llama-based models
"tokenizers>=0.15.2", # pythia, falcon, redpajama
"requests>=2.31.0", # litgpt.data
"litdata>=0.2.2", # litgpt.data
"zstandard>=0.22.0", # litgpt.data.prepare_slimpajama.py
"pandas>=1.9.0", # litgpt.data.prepare_starcoder.py
"pyarrow>=15.0.2", # litgpt.data.prepare_starcoder.py
"tensorboard>=2.14.0", # litgpt.pretrain
"torchmetrics>=1.3.1", # litgpt.pretrain
"datasets>=2.18.0", # litgpt.evaluate
"transformers>=4.38.0", # litgpt.evaluate
"lm-eval>=0.4.2", # litgpt.evaluate
"safetensors", # download
"safetensors>=0.4.3", # download
"huggingface_hub[hf_transfer]>=0.21.0" # download
]

[build-system]
requires = [
"setuptools",
"wheel",
"setuptools>=68.2.2",
"wheel>=0.41.2",
]
build-backend = "setuptools.build_meta"

Expand Down
2 changes: 2 additions & 0 deletions tests/test_thunder_fsdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ def set_up_planner(self, state_dict, metadata, is_coordinator):

@RunIf(min_cuda_gpus=2, thunder=True, standalone=True)
def test_save_load_sharded_checkpoint(tmp_path):
pytest.skip("Temporarily disabled, often exceeds 5 min timeout")

strategy = ThunderFSDPStrategy(state_dict_type="sharded", broadcast_from=0)
fabric = Fabric(accelerator="cuda", devices=2, strategy=strategy)
fabric.launch()
Expand Down
2 changes: 1 addition & 1 deletion tutorials/download_model_weights.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ litgpt download \
 
## Finetunes and other model variants
Sometimes you want to download the weights of a finetune of one of the models listed above. To do this, you need to manually specifiy the `model_name` associated to the config to use. For example:
Sometimes you want to download the weights of a finetune of one of the models listed above. To do this, you need to manually specify the `model_name` associated to the config to use. For example:
```bash
litgpt download \
Expand Down

0 comments on commit 4b91010

Please sign in to comment.