Skip to content

Commit 99463fe

Browse files
authored
drop upper bounds in dependencies (#2022)
1 parent e2f99d4 commit 99463fe

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

litgpt/pretrain.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,19 @@ def main(
228228
fabric.load(resume, state)
229229

230230
train_time = time.perf_counter()
231+
232+
# work around PyTorch issue https://github.com/pytorch/pytorch/issues/152162
233+
# which does not like the lazy initialization to be called in dynamo.
234+
# Happens with PyTorch 2.7.
235+
if (
236+
torch.__version__.startswith("2.7.")
237+
and (model._forward_module.__class__.__name__ == "OptimizedModule")
238+
and (model._forward_module._orig_mod.__class__.__name__ == "FullyShardedDataParallel")
239+
):
240+
from torch.distributed.fsdp._runtime_utils import _root_pre_forward
241+
242+
_root_pre_forward(model._forward_module._orig_mod, model._forward_module._orig_mod, [], {})
243+
231244
fit(
232245
fabric=fabric,
233246
devices=devices,

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ dependencies = [
2929
"huggingface-hub>=0.23.5",
3030
"jsonargparse[signatures]>=4.30.1,<=4.32.1; python_version<='3.9'", # 4.33 does not seem to be compatible with Python 3.9
3131
"jsonargparse[signatures]>=4.37; python_version>'3.9'", # required to work with python3.12+
32-
"lightning>=2.5,<2.6",
32+
"lightning>=2.5",
3333
"numpy<2", # for older Torch versions
3434
"psutil==7",
3535
"safetensors>=0.4.3",
3636
# tokenization in most models:
3737
"tokenizers>=0.15.2",
38-
"torch>=2.5,<2.7",
38+
"torch>=2.5",
3939
# convert_hf_checkpoint
4040
"tqdm>=4.66",
4141
]

0 commit comments

Comments
 (0)