Skip to content

Commit 8f7362f

Browse files
committed
ignore some files during upload
1 parent d8c366a commit 8f7362f

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

export/huggingface.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from utils.datatypes import FilePath
1010
from export.helpers import get_latest_model
11+
from utils.constants import MODEL_FILE_PREFIX, CHECKPOINT_FILE_PREFIX
1112

1213
def upload_dataset(folder:FilePath):
1314
"""
@@ -21,7 +22,13 @@ def upload_dataset(folder:FilePath):
2122
folder_path=folder,
2223
repo_id=dataset_name,
2324
repo_type="dataset",
24-
ignore_patterns=["dataset/"]
25+
ignore_patterns=[
26+
"dataset/",
27+
"*.json",
28+
f"{MODEL_FILE_PREFIX}*",
29+
f"{CHECKPOINT_FILE_PREFIX}*",
30+
"*.png",
31+
]
2532
)
2633

2734
def upload_model(folder:str):

export/kaggle.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import kagglehub as kh
99

1010
from utils.datatypes import FilePath
11+
from utils.constants import MODEL_FILE_PREFIX, CHECKPOINT_FILE_PREFIX
1112

1213
def upload_dataset(folder:FilePath):
1314
"""
@@ -20,7 +21,13 @@ def upload_dataset(folder:FilePath):
2021
dataset_name,
2122
folder,
2223
version_notes=version,
23-
ignore_patterns=["dataset/"]
24+
ignore_patterns=[
25+
"dataset/",
26+
"*.json",
27+
f"{MODEL_FILE_PREFIX}*",
28+
f"{CHECKPOINT_FILE_PREFIX}*",
29+
"*.png",
30+
]
2431
)
2532

2633
def upload_model(folder:str):
@@ -35,7 +42,16 @@ def upload_model(folder:str):
3542
handle=model_name,
3643
local_model_dir=folder,
3744
version_notes=version,
38-
ignore_patterns=["dataset/","ghz*","*.zip","*.h5","*.csv"]
45+
ignore_patterns=[
46+
"dataset/",
47+
"ghz*",
48+
"*.pth"
49+
"*.zip",
50+
"*.h5",
51+
"*.csv",
52+
"*.png",
53+
"*.json"
54+
]
3955
)
4056

4157
if __name__ == "__main__":

train.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from utils.constants import (
2020
DEBUG,
2121
MODEL_FILE_PREFIX,
22+
CHECKPOINT_FILE_PREFIX,
2223
dataset_file,
2324
images_h5_file,
2425
ghz_file,
@@ -265,7 +266,7 @@ def save(
265266
scheduler: StateDict,
266267
):
267268
"""Save checkpoint data"""
268-
path = os.path.join(folder, "checkpoint_%s.pth" % (time.ctime()))
269+
path = os.path.join(folder, "%s%s.pth" % (CHECKPOINT_FILE_PREFIX, time.ctime()))
269270
print("%sSaving checkpoint at: %s...%s" % (Colors.MAGENTABG, path, Colors.ENDC))
270271
checkpoint = {
271272
"epoch": epoch,

utils/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
DEFAULT_CHECKPOINT = None
2727

2828
MODEL_FILE_PREFIX = "model_"
29+
CHECKPOINT_FILE_PREFIX = "checkpoint_"
2930

3031
# ruff: noqa: E731
3132
dataset_path = lambda target_folder: os.path.join(target_folder, "dataset")

0 commit comments

Comments
 (0)