Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't resolve filepaths #219

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions zamba/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ def check_files_exist_and_load(
Returns:
pd.DataFrame: DataFrame with valid and loadable videos.
"""
# update filepath column to prepend data_dir if filepath column is not an absolute path
data_dir = Path(data_dir).resolve()
# update filepath column to prepend data_dir
df["filepath"] = str(data_dir) / df.filepath.path

# we can have multiple rows per file with labels so limit just to one row per file for these checks
Expand All @@ -104,7 +103,8 @@ def check_files_exist_and_load(
logger.info(
f"Checking all {len(files_df):,} filepaths exist. Can take up to a minute for every couple thousand files."
)
invalid_files = files_df[~files_df.filepath.path.exists()]
exists = files_df["filepath"].path.exists()
invalid_files = files_df[~exists]

# if no files exist
if len(invalid_files) == len(files_df):
Expand Down Expand Up @@ -355,7 +355,7 @@ class TrainConfig(ZambaBaseModel):
"""

labels: Union[FilePath, pd.DataFrame]
data_dir: DirectoryPath = Path.cwd()
data_dir: DirectoryPath = ""
checkpoint: Optional[FilePath] = None
scheduler_config: Optional[Union[str, SchedulerConfig]] = "default"
model_name: Optional[ModelEnum] = ModelEnum.time_distributed
Expand Down Expand Up @@ -604,7 +604,7 @@ class PredictConfig(ZambaBaseModel):
default cache directory. Defaults to None.
"""

data_dir: DirectoryPath = Path.cwd()
data_dir: DirectoryPath = ""
filepaths: Optional[FilePath] = None
checkpoint: Optional[FilePath] = None
model_name: Optional[ModelEnum] = ModelEnum.time_distributed
Expand Down