mosaicml / mosaicml/streaming

exist_ok mds_kwargs not passable to dataframe_to_mds()

Open
#871 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

Hello.

I want dataframe_to_mds() to overwrite the output directory if the directory already exists.

The documentation for mds_kwargs states to "Refer to https://docs.mosaicml.com/projects/streaming/en/stable/api_reference/generated/streaming.MDSWriter.html"

When looking at the documentation for MDSWriter(), one of the accepted **kwargs is the "exist_ok" field. I tried setting this field to True, but when looking at my stacktrace, it showed that it was still defaulting to False.

In dataframe_to_mds.py line 286, CloudUploader.get() is called, but exist_ok is not passed through. Therefore, CloudUploader uses the default value of False.

In line 299 of dataframe_to_mds.py, the write_mds() function is applied. The exist_ok field is correctly passed in this function (which calls MDSWriter), but it is not passed in line 286 to CloudUploader.

To me, this seems like a simple fix of passing the exist_ok field from **kwargs in the CloudUploader() call in line 286.

That said, I am not too familiar with DataLoaders for distributed training so there may be some reasoning that exist_ok should always be false for CloudUploader() in this context?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read dataframe_to_mds.py around lines 286 and 299, comparing the CloudUploader.get() call with write_mds() and how each receives kwargs. Confirm whether exist_ok should apply to CloudUploader in this context, then verify that an existing output directory can be overwritten without breaking the dataframe_to_mds() flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.