Skip to content

Commit

Permalink
Bump min torch version to 2.3.0 (#1152)
Browse files Browse the repository at this point in the history
* bump min torch

* make random correct less likely

* bf16 precisioin

* fix

* new dataset?

* try again

* debug

* debug

* pin hf hub

* remove debug

---------

Co-authored-by: Milo Cress <milo.cress@databricks.com>
  • Loading branch information
dakinggg and milocress committed May 2, 2024
1 parent 0d58f46 commit a3e0fb9
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 35 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ jobs:
strategy:
matrix:
include:
- name: "2.2.1_cu121_flash2"
base_image: mosaicml/pytorch:2.2.1_cu121-python3.11-ubuntu20.04
dep_groups: "[gpu-flash2]"
- name: "2.2.1_cu121_flash2_aws"
base_image: mosaicml/pytorch:2.2.1_cu121-python3.11-ubuntu20.04-aws
dep_groups: "[gpu-flash2]"
- name: "2.3.0_cu121_flash2"
base_image: mosaicml/pytorch:2.3.0_cu121-python3.11-ubuntu20.04
dep_groups: "[gpu-flash2]"
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/pr-cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
strategy:
matrix:
include:
- name: "cpu-2.2.1"
container: mosaicml/pytorch:2.2.1_cpu-python3.11-ubuntu20.04
markers: "not gpu"
pytest_command: "coverage run -m pytest"
- name: "cpu-2.3.0"
container: mosaicml/pytorch:2.3.0_cpu-python3.11-ubuntu20.04
markers: "not gpu"
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/pr-gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: "gpu-2.2.1"
container: mosaicml/pytorch:2.2.1_cu121-python3.11-ubuntu20.04
markers: "gpu"
pip_deps: "[all]"
pytest_command: "coverage run -m pytest"
- name: "gpu-2.3.0"
container: mosaicml/pytorch:2.3.0_cu121-python3.11-ubuntu20.04
markers: "gpu"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,24 @@ If you have success/failure using LLM Foundry on other systems, please let us kn

| Device | Torch Version | Cuda Version | Status |
| -------------- | ------------- | ------------ | ---------------------------- |
| A100-40GB/80GB | 2.2.1 | 12.1 | :white_check_mark: Supported |
| H100-80GB | 2.2.1 | 12.1 | :white_check_mark: Supported |
| A100-40GB/80GB | 2.3.0 | 12.1 | :white_check_mark: Supported |
| H100-80GB | 2.3.0 | 12.1 | :white_check_mark: Supported |

## MosaicML Docker Images
We highly recommend using our prebuilt Docker images. You can find them here: https://hub.docker.com/orgs/mosaicml/repositories.

The `mosaicml/pytorch` images are pinned to specific PyTorch and CUDA versions, and are stable and rarely updated.

The `mosaicml/llm-foundry` images are built with new tags upon every commit to the `main` branch.
You can select a specific commit hash such as `mosaicml/llm-foundry:2.2.1_cu121_flash2-36ab1ba` or take the latest one using `mosaicml/llm-foundry:2.2.1_cu121_flash2-latest`.
You can select a specific commit hash such as `mosaicml/llm-foundry:2.3.0_cu121_flash2-36ab1ba` or take the latest one using `mosaicml/llm-foundry:2.3.0_cu121_flash2-latest`.

**Please Note:** The `mosaicml/llm-foundry` images do not come with the `llm-foundry` package preinstalled, just the dependencies. You will still need to `pip install llm-foundry` either from PyPi or from source.

| Docker Image | Torch Version | Cuda Version | LLM Foundry dependencies installed? |
| ------------------------------------------------------ | ------------- | ----------------- | ----------------------------------- |
| `mosaicml/pytorch:2.2.1_cu121-python3.11-ubuntu20.04` | 2.2.1 | 12.1 (Infiniband) | No |
| `mosaicml/llm-foundry:2.2.1_cu121_flash2-latest` | 2.2.1 | 12.1 (Infiniband) | Yes |
| `mosaicml/llm-foundry:2.2.1_cu121_flash2_aws-latest` | 2.2.1 | 12.1 (EFA) | Yes |
| `mosaicml/pytorch:2.3.0_cu121-python3.11-ubuntu20.04` | 2.3.0 | 12.1 (Infiniband) | No |
| `mosaicml/llm-foundry:2.3.0_cu121_flash2-latest` | 2.3.0 | 12.1 (Infiniband) | Yes |
| `mosaicml/llm-foundry:2.3.0_cu121_flash2_aws-latest` | 2.3.0 | 12.1 (EFA) | Yes |


# Installation
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-1b-eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ integrations:
command: |
cd llm-foundry/scripts/
composer eval/eval.py /mnt/config/parameters.yaml
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
name: mpt-1b-eval

compute:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-1b-max-seq-len-8k.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ command: |
--out_root ./my-copy-c4 --splits train_small val_small \
--concat_tokens 8192 --tokenizer EleutherAI/gpt-neox-20b --eos_text '<|endoftext|>'
composer train/train.py /mnt/config/parameters.yaml
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
name: mpt-1b-ctx-8k-gpus-8

compute:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-1b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ command: |
eval_loader.dataset.split=val_small \
max_duration=100ba \
eval_interval=0
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
name: mpt-1b-gpus-8

compute:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-benchmark-mpt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ compute:
# cluster: TODO # Name of the cluster to use for this run
# gpu_type: a100_80gb # Type of GPU to use. We use a100_80gb in our experiments

image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest

integrations:
- integration_type: git_repo
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-convert-composer-to-hf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ command: |
--hf_output_path s3://bucket/folder/hf/ \
--output_precision bf16 \
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
name: convert-composer-hf

compute:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-hf-eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ gpu_num: 8
# gpu_type:
# cluster: # replace with your cluster here!

image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest

# The below is injected as a YAML file: /mnt/config/parameters.yaml
parameters:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-hf-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ command: |
"Here's a quick recipe for baking chocolate chip cookies: Start by" \
"The best 5 cities to visit in Europe are"
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
name: hf-generate

compute:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-llama2-finetune.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ integrations:
command: |
cd llm-foundry/scripts
composer train/train.py /mnt/config/parameters.yaml
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
name: llama2-finetune

compute:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-openai-eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ gpu_num: #
gpu_type: #
cluster: # replace with your cluster here!

image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest

# The below is injected as a YAML file: /mnt/config/parameters.yaml
parameters:
Expand Down
2 changes: 1 addition & 1 deletion mcli/mcli-pretokenize-oci-upload.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: c4-2k-pre-tokenized
image: mosaicml/llm-foundry:2.2.1_cu121_flash2-latest
image: mosaicml/llm-foundry:2.3.0_cu121_flash2-latest
compute:
gpus: 8 # Number of GPUs to use

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
'accelerate>=0.25,<0.26', # for HF inference `device_map`
'transformers>=4.40,<4.41',
'mosaicml-streaming>=0.7.5,<0.8',
'torch>=2.2.1,<2.4',
'torch>=2.3.0,<2.4',
'datasets>=2.19,<2.20',
'fsspec==2023.6.0', # newer version results in a bug in datasets that duplicates data
'sentencepiece==0.1.97',
Expand All @@ -69,7 +69,7 @@
'onnx==1.14.0',
'onnxruntime==1.15.1',
'boto3>=1.21.45,<2',
'huggingface-hub>=0.19.0,<1.0',
'huggingface-hub>=0.19.0,<0.23',
'beautifulsoup4>=4.12.2,<5', # required for model download utils
'tenacity>=8.2.3,<9',
'catalogue>=2,<3',
Expand Down
1 change: 1 addition & 0 deletions tests/a_scripts/inference/test_convert_composer_to_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ def test_huggingface_conversion_callback(
trainer = Trainer(
model=original_model,
device='gpu',
precision='amp_bf16',
fsdp_config=fsdp_config if fsdp_state_dict_type is not None else None,
train_dataloader=train_dataloader,
save_folder=os.path.join(tmp_path, 'checkpoints'),
Expand Down
2 changes: 2 additions & 0 deletions tests/data/test_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ def test_finetuning_dataloader(use_chat_formatting: bool,
def test_finetuning_dataloader_safe_load(hf_name: str,
hf_revision: Optional[str],
expectation: ContextManager):
# Clear the folder
shutil.rmtree(DOWNLOADED_FT_DATASETS_DIRPATH, ignore_errors=True)
cfg = DictConfig({
'name': 'finetuning',
'dataset': {
Expand Down
2 changes: 1 addition & 1 deletion tests/eval/local_data/gsm8k_small.jsonl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"context": "Janet’s ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?", "chain_of_thought": "Janet sells 16 - 3 - 4 = <<16-3-4=9>>9 duck eggs a day.\nShe makes 9 * 2 = $<<9*2=18>>18 every day at the farmer’s market.", "answer": "18"}
{"context": "A robe takes 2 bolts of blue fiber and half that much white fiber. How many bolts in total does it take?", "chain_of_thought": "It takes 2/2=<<2/2=1>>1 bolt of white fiber\nSo the total amount of fabric is 2+1=<<2+1=3>>3 bolts of fabric", "answer": "3"}
{"context": "A robe takes 2 bolts of blue fiber and half that much white fiber. How many bolts in total does it take?", "chain_of_thought": "It takes 2/2=<<2/2=1>>1 bolt of white fiber\nSo the total amount of fabric is 2+1=<<2+1=3>>3 bolts of fabric", "answer": "12334"}
{"context": "Josh decides to try flipping a house. He buys a house for $80,000 and then puts in $50,000 in repairs. This increased the value of the house by 150%. How much profit did he make?", "chain_of_thought": "The cost of the house and repairs came out to 80,000+50,000=$<<80000+50000=130000>>130,000\nHe increased the value of the house by 80,000*1.5=<<80000*1.5=120000>>120,000\nSo the new value of the house is 120,000+80,000=$<<120000+80000=200000>>200,000\nSo he made a profit of 200,000-130,000=$<<200000-130000=70000>>70,000", "answer": "70000"}
{"context": "James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week?", "chain_of_thought": "He sprints 3*3=<<3*3=9>>9 times\nSo he runs 9*60=<<9*60=540>>540 meters", "answer": "540"}
2 changes: 1 addition & 1 deletion tests/eval/test_in_context_learning_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ def test_qa_task_with_cot_dataloader(
assert all(item.count('Q: ') == num_fewshot + 1 for item in decoded_batch)
assert all(item.count('\nA:') == num_fewshot + 1 for item in decoded_batch)

assert batch['labels'] == [['18'], ['3']]
assert batch['labels'] == [['18'], ['12334']]
if num_fewshot == 0:
assert decoded_batch[0].endswith(
"Q: Janet’s ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?\nA: Let's think step by step."
Expand Down

0 comments on commit a3e0fb9

Please sign in to comment.