Skip to content

is_mounted_filepath incorrect logic does not allow different paths inside and outside of container #1173

@esnvidia

Description

@esnvidia

referring to this function in the code:

if path.startswith(mount_dest):

Ex.

mounts:
  - /lustre/path/to/models/cache/huggingface:/cache/huggingface

env_vars:
  - HF_HOME=/lustre/path/to/models/cache/huggingface
>>> import yaml
>>> from nemo_skills.pipeline.utils.mounts import is_mounted_filepath
>>> from nemo_skills.pipeline.utils.cluster import get_env_variables
>>> with open('cluster.yaml', 'r') as f:
...     config = yaml.safe_load(f)
...
>>> env_vars = get_env_variables(config)
>>> env_vars
{'HF_HOME': '/lustre/path/to/models/cache/huggingface', ...}
>>> is_mounted_filepath(config, env_vars['HF_HOME'])
False

Here is the code in the current function:

   mounts = mounts or (get_mounts_from_config(cluster_config) + ["/nemo_run/code:/nemo_run/code"])
    # Find which mount path matches the filepaths prefix
    for mount in mounts:
        mount_source, mount_dest = mount.split(":")
        if path.startswith(mount_dest):
            return True

So I have: /lustre/path/to/models/cache/huggingface:/cache/huggingface

which is split up as:

mount_source= /lustre/path/to/models/cache/huggingface
mount_dest=cache/huggingface\

then checks if HF_HOME=/lustre/path/to/models/cache/huggingface starts with mount_dest=/cache/huggingface

That’s dumb logic - it wants the mount point outside to be the same start string as inside the container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions