Skip to content

Commit 2251055

Browse files
authored
store: drop requirements_file_path (#16527)
1 parent d562319 commit 2251055

File tree

2 files changed

+3
-44
lines changed

2 files changed

+3
-44
lines changed

src/lightning/store/cloud_api.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
_save_model,
3737
_save_model_code,
3838
_save_model_weights,
39-
_save_requirements_file,
4039
_submit_data_to_url,
4140
_write_and_save_requirements,
4241
)
@@ -51,7 +50,6 @@ def upload_to_cloud(
5150
model=None,
5251
source_code_path: str = "",
5352
checkpoint_path: str = "",
54-
requirements_file_path: str = "",
5553
requirements: Optional[List[str]] = None,
5654
weights_only: bool = False,
5755
api_key: str = "",
@@ -77,12 +75,9 @@ def upload_to_cloud(
7775
will raise an error. (Optional)
7876
checkpoint_path:
7977
The path to the checkpoint that needs to be uploaded. (Optional)
80-
requirements_file_path:
81-
The path to the requirements file, will always be uploaded with the name of `requirements.txt`.
8278
requirements:
8379
List of requirements as strings, that will be written as `requirements.txt` and
84-
then uploaded. If both `requirements_file_path` and `requirements` are passed,
85-
a warning is raised as `requirements` is given the priority over `requirements_file_path`.
80+
then uploaded.
8681
weights_only:
8782
If set to `True`, it will only save model weights and nothing else. This raises
8883
an error if `weights_only` is `True` but no `model` is passed.
@@ -146,28 +141,13 @@ def upload_to_cloud(
146141
stored=stored,
147142
)
148143

149-
if requirements and requirements_file_path:
150-
# TODO: Later on, figure out how to merge requirements from both args
151-
logging.warning(
152-
"You provided a requirements file (..., requirements_file_path=...)"
153-
" and requirements list (..., requirements=...). In case of any collisions,"
154-
" anything that comes from requirements=... will be given the priority."
155-
)
156-
157144
if requirements:
158145
stored = _write_and_save_requirements(
159146
model_name,
160147
requirements=requirements,
161148
stored=stored,
162149
tmpdir=tmpdir,
163150
)
164-
elif requirements_file_path:
165-
stored = _save_requirements_file(
166-
model_name,
167-
requirements_file_path=requirements_file_path,
168-
stored=stored,
169-
tmpdir=tmpdir,
170-
)
171151

172152
url = _save_meta_data(
173153
model_name,

tests/tests_cloud/test_requirements.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
import os
22

3-
from tests_cloud import _API_KEY, _PROJECT_ID, _PROJECT_ROOT, _USERNAME
3+
from tests_cloud import _API_KEY, _PROJECT_ID, _USERNAME
44
from tests_cloud.helpers import cleanup
55

66
from lightning.store import download_from_cloud, upload_to_cloud
77
from lightning.store.save import _LIGHTNING_STORAGE_DIR
88
from pytorch_lightning.demos.boring_classes import BoringModel
99

1010

11-
def test_requirements_as_a_file(version: str = "latest", model_name: str = "boring_model"):
12-
cleanup()
13-
14-
requirements_file_path = os.path.join(_PROJECT_ROOT, "requirements", "app", "base.txt")
15-
16-
upload_to_cloud(
17-
model_name,
18-
version=version,
19-
model=BoringModel(),
20-
requirements_file_path=requirements_file_path,
21-
api_key=_API_KEY,
22-
project_id=_PROJECT_ID,
23-
)
24-
25-
download_from_cloud(f"{_USERNAME}/{model_name}")
26-
27-
req_folder_path = os.path.join(_LIGHTNING_STORAGE_DIR, _USERNAME, model_name, version)
28-
assert os.path.isdir(req_folder_path), "missing: %s" % req_folder_path
29-
assert "requirements.txt" in os.listdir(req_folder_path), "among files: %r" % os.listdir(req_folder_path)
30-
31-
32-
def test_requirements_as_a_list(version: str = "1.0.0", model_name: str = "boring_model"):
11+
def test_requirements(version: str = "1.0.0", model_name: str = "boring_model"):
3312
cleanup()
3413

3514
requirements_list = ["pytorch_lightning==1.7.7", "lightning"]

0 commit comments

Comments
 (0)