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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPU support #79

Open
miguelalba96 opened this issue Mar 26, 2024 · 5 comments
Open

TPU support #79

miguelalba96 opened this issue Mar 26, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@miguelalba96
Copy link

miguelalba96 commented Mar 26, 2024

馃殌 Feature

TPU support

Motivation

Does litdata supports TPU environments, specifically when using lighting fabric?

Additional context

I have >16M image-text pairs I am writing in mosaic-ml streaming format to train contrastive models, I am working with lighting fabric to train using DDP in GCP and I want to move to TPU training. mosaic-ml streaming dataset doesn't support TPU (afaik), all of this bring me to the questions:

  • Does litdata work on TPU?
  • Does it require to set up something in the code additional to what is provided in the available documentation. (ex. is it necessary to provide a distributed sampler? or set different env variables?)
  • Do you have an example of how to setup TPU training with litdata?
@miguelalba96 miguelalba96 added enhancement New feature or request help wanted Extra attention is needed labels Mar 26, 2024
Copy link

Hi! thanks for your contribution!, great first issue!

@tchaton
Copy link
Collaborator

tchaton commented Mar 29, 2024

Hey @miguelalba96,

I haven't tried with TPU. Maybe @carmocca would know more.

@carmocca
Copy link
Contributor

carmocca commented Apr 3, 2024

litdata is meant to be used with a regular DataLoader, so there's nothing specific to do on a TPU machine. If you use Fabric or PyTorch Lightning, that will take care of enabling the DistributedSampler or do any required XLA steps, but these are common to all TPU runs, not just those using litdata

@dasoto
Copy link

dasoto commented Apr 10, 2024

I will recommend setting this env variables:
DATA_OPTIMIZER_GLOBAL_RANK
DATA_OPTIMIZER_NUM_WORKERS
DATA_OPTIMIZER_NUM_NODES

Otherwise the StreamDataloader will not be aware of the distribution.

@tchaton
Copy link
Collaborator

tchaton commented Apr 11, 2024

Yes, as @dasoto mentioned, I didn't add wiring for TPU env detection. Feel free to contribute support for it if you try litdata on TPUs.

@Borda Borda removed the help wanted Extra attention is needed label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants