Skip to content

Conversation

@deependujha
Copy link
Collaborator

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Fixes #193

To test it, run the script:

import os
from litdata import optimize

def compress(index):
    return (index, index ** 2)

optimize(
    fn=compress,
    inputs=list(range(100)),
    num_workers=2,
    output_dir="my_output",
    chunk_bytes="64MB",
    num_nodes=2,
)

The optimized dataset will be present in: /teamspace/jobs/{job_name}/nodes-0/my_output.

Read the optimized data using:

from litdata import StreamingDataset

output_dir = "/teamspace/jobs/litdata-optimize-2024-07-08-17-08-51/nodes.0/my_output"

dataset = StreamingDataset(output_dir)

print(dataset[:])

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@14a47f2). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             main   #214   +/-   ##
=====================================
  Coverage        ?    77%           
=====================================
  Files           ?     33           
  Lines           ?   4709           
  Branches        ?      0           
=====================================
  Hits            ?   3626           
  Misses          ?   1083           
  Partials        ?      0           

Copy link
Collaborator

@tchaton tchaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deependujha Looks great ! Can you add an example in the README in another PR ?

@tchaton tchaton merged commit c4c9117 into Lightning-AI:main Jul 8, 2024
@deependujha deependujha deleted the fix/local-path-in-distributed-optimize branch July 9, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When providing a local path to the optimize method, make it work in a distributed settings for Jobs

2 participants