Fluiddocs
Run and watch

Libraries and frameworks

Which training, tracking and data libraries Fluid can pause and move, what each one's limit is, and where Fluid tells you.

Warnings and limits

  • Fluid pauses a program at pause points in your own code. A library that runs the training loop itself, keeps a background thread or process, or holds state Fluid has not learned to carry changes what a move, a suspend and a spot checkpoint can do.
  • Fluid tells you when this applies: in the plan, for each library your requirements name, and in the job's events, when your program first uses one.
  • A library that is not on this page has no known limit. It is not a promise that it moves: the checkpoint check says what a checkpoint of your job could not carry. See Spot and checkpoints.
  • A level of waits, blocks, breaks or unverified matters most on spot. A notice that cannot be saved loses the work since the last checkpoint.

Levels

LevelWhat it means
movesFluid pauses and carries it. A test proves it.
waitsThe job runs. A move, a suspend or a spot checkpoint waits until the library's call returns.
blocksWhile the library is in use no checkpoint can be taken. The job cannot move or be saved on a notice.
breaksA move goes through and the library stops working after it.
unverifiedNot tested with Fluid yet. Its state may not pause or move.

Libraries

LibraryLevelLimit
Hugging Face Trainer (transformers, TRL, sentence-transformers)movesFluid pauses inside trainer.train() and trainer.evaluate(). On several GPUs, run the script with --ranks N. See Hugging Face Trainer.
Hugging Face Accelerate (a loop you write over an Accelerator)movesThe loop moves with what the Accelerator prepared and its settings. Over a data loader the Accelerator prepared, a pause is taken between two steps; with --ranks N it waits for the end of the epoch. On several GPUs, run the script with --ranks N. See Hugging Face Accelerate.
Hugging Face datasets, streamingmovesA loop over a streaming dataset goes on from the row it was at. See Fine-tuning.
UnslothunverifiedIt trains through the Hugging Face Trainer and replaces parts of the model and the trainer with its own. That combination is not verified yet.
PyTorch LightningmovesFluid pauses inside trainer.fit(), validate(), test() and predict(). With strategy="ddp", run the script with --ranks N. See PyTorch Lightning.
scikit-learnmovesA loop of your own over estimators pauses between two calls and moves with what was fitted so far. One call of fit() is waited for. See scikit-learn and skorch.
skorchmovesA fit() of a skorch net pauses in the middle of an epoch and moves, with its callbacks as the fit under way holds them. See scikit-learn and skorch.
spaCymovesA pipeline your job holds moves as spaCy saves one, with the components and extensions your script registered. A pipeline from a model package needs the same package and version where the job lands. A pipeline on a GPU cannot move. See spaCy.
Lightning FabricmovesA loop you write over Fabric's data loaders pauses at every batch. On several devices, run the script with --ranks N. See PyTorch Lightning.
Weights & BiasesunverifiedOffline runs pause and move. A run that logs to W&B's servers continues by W&B's own resume, which is not verified yet. See Weights & Biases.
fastaimovesShown on a tabular learner, with pandas 2.3 and pandas 3: Fluid pauses inside learn.fit() and the job moves. See fastai.
PyTorch IgnitemovesFluid pauses inside Engine.run(), between two events of the run, and continues there on the next machine. See PyTorch Ignite.
TensorBoardmovesA SummaryWriter goes on in a new event file of the same log directory. See TensorBoard.
MLflowmovesThe active run is started again by its id where the job lands. See MLflow.
matplotlibmovesA job moves with the figures it has open and the settings it changed. The backend is chosen again where the job lands. See matplotlib.
XGBoostmovesFluid pauses inside train(), cv() and the scikit-learn fit(), between two boosting rounds. See Gradient boosting.
LightGBMwaitsA fit is one call into LightGBM. A pause waits until it returns. A fit made in several calls pauses between them. See Gradient boosting.
CatBoostwaitsA fit is one call into CatBoost. A pause waits until it returns. The job moves before and after it. See Gradient boosting.
PyTorch distributed training (torchrun, accelerate launch, DeepSpeed, FSDP)blocksA job whose script starts its training processes itself cannot pause or move: Fluid did not start them. Run a script written for torchrun with --ranks N instead: Fluid starts its ranks, and the job pauses and moves. See Several GPUs.
Ray (Ray Train, Tune and Data too)blocksA job that starts or joins a Ray cluster cannot pause or move: the cluster is Ray's own processes on the machine. See Ray, Dask and Spark.
Dask distributed (a client, a local cluster)blocksA job that holds a Dask client cannot pause or move. Dask computed in the job's own process, with no client, moves. See Ray, Dask and Spark.
Apache Spark (PySpark)blocksA job that starts a Spark session cannot pause or move: the session is a connection to a Java process beside the job. See Ray, Dask and Spark.
bitsandbytesmovesA model loaded in 8-bit or 4-bit and fine-tuned through a LoRA adapter pauses and moves with its quantized weights as they are. See Fine-tuning.
vLLMunverifiedFluid's tests have not moved it yet. Its engine keeps its state on the GPU and in threads of its own. See GPU-only libraries.
SGLangunverifiedFluid's tests have not moved it yet. Its engine keeps its state on the GPU and in processes of its own. See GPU-only libraries.
JAX (Flax, Optax)movesA training loop of your own with jitted steps pauses and moves, on CPUs and on an NVIDIA GPU. See JAX.
JAX on several devices (a mesh, pmap, jax.distributed, keras.distribution)blocksA job that places arrays over a mesh of devices or joins jax.distributed cannot pause or move. Keep the arrays on one device, with no mesh, and the job pauses and moves. See JAX.
TensorFlowmovesA training loop of your own with tf.function steps and a tf.data pipeline pauses and moves, on CPUs and on an NVIDIA GPU. See TensorFlow.
TensorFlow distribution strategies (tf.distribute)blocksA job that trains under a strategy cannot pause or move, on one device either. Train without a strategy, on one device, and the job pauses and moves. See TensorFlow.
Legacy Keras (tf_keras, TF_USE_LEGACY_KERAS=1)blocksA job that makes a legacy Keras 2 model or optimizer cannot pause or move. Use Keras 3 (import keras, no tf_keras) and the job pauses and moves. See Keras.
Keras 3movesFluid pauses inside model.fit(), evaluate() and predict() on the PyTorch, JAX and TensorFlow backends. See Keras.
CuPymovesA loop of your own over CuPy arrays pauses and moves, with the kernels it compiled. See GPU-only libraries.
RAPIDS cuDFmovesA loop of your own over cuDF data frames, series and indexes pauses and moves. See GPU-only libraries.
RAPIDS cuMLwaitsA fit is one call into cuML. A pause waits until it returns. The job moves before and after it, with its fitted models. See GPU-only libraries.
timmmovesA training loop of your own over a timm model pauses and moves, with timm's optimizers, schedules, averaged model and mixup. See Model libraries.
MONAImovesA training loop of your own with MONAI's networks, losses, transforms, datasets and data loader pauses and moves. See Model libraries.
PyTorch GeometricmovesA training loop of your own over a graph model pauses and moves, with its message passing layers and the library's loader of graphs. See Model libraries.
Optuna (study.ask() and study.tell() in a loop you write)movesThe search pauses between two trials and goes on to the trials an unmoved search runs. See Hyperparameter search.
Optuna's optimize loop (study.optimize())movesFluid pauses inside study.optimize(). With n_jobs above one, a pause waits until the call returns. See Hyperparameter search.
DiffusersmovesLoops of your own over a pipeline's calls, over a scheduler's steps, and a training loop pause and move. A pause waits for a pipeline call to return. See Model libraries.
ONNX RuntimemovesA loop of your own that runs batches through a session pauses and moves. The session is made again where the job lands. Keep the model file under the working directory. See ONNX Runtime.
Ultralytics YOLOmovesFluid pauses inside model.train() and carries the trainer with its model, optimizer, datasets and run directory. With loader workers the augmentations after a move are new ones. Several GPUs are not verified. See Ultralytics YOLO.
MMEngine (MMDetection and the other OpenMMLab libraries)movesFluid pauses inside runner.train(), between two iterations, and the job goes on at the next batch with its logs and checkpoints in the same work directory. See MMEngine.
Detectron2unverifiedIts trainers run the training loop inside the library. Whether a pause stops inside it is not verified yet. See Not verified yet.
CometblocksA job with an experiment open is not paused or moved: the experiment keeps open files and threads of its own. Once it is ended the job pauses again, with Comet's automatic logging off. See Comet.
NeptuneblocksA job with a run open is not paused or moved: the run keeps open files and threads of its own. Once it is stopped the job pauses again. See Neptune.
ClearMLunverifiedA task reports from threads and a process of its own and patches the libraries it tracks. Whether the same task continues after a move is not verified yet. See Not verified yet.
NVIDIA DALIunverifiedIts pipelines run in threads of its own and on the GPU. Whether a job that holds one pauses and moves is not verified yet. See Not verified yet.
WebDatasetmovesA job pauses inside a pass over the shards and moves, through a data loader with workers or read by the loop itself. Through a loader without workers a pause waits for the pass to end. See WebDataset.
FFCVunverifiedIts loader reads in threads of its own through code it compiles. Whether a job that holds one pauses and moves is not verified yet. See Not verified yet.
TensorRTunverifiedAn engine is built for one GPU model and one TensorRT version. Whether a job that holds one pauses is not verified yet. See Not verified yet.
PyTorch data loader workers (num_workers above zero)movesThe loader goes on at its position, in the same order. Moved within the first 64 batches of an epoch, its random transforms go on as an unmoved run's; further in, with workers kept from an earlier epoch, or with in_order=False, they draw other numbers and the move says so. See Data loader workers.
Atari environments (ALE) (ale-py 0.9 or later)movesAn environment moves with its console: the next step and the next reset return what they would have returned. See Reinforcement learning.
TorchScript (torch.jit.script, torch.jit.trace, torch.jit.freeze)movesA scripted, traced or frozen module pauses and moves, training or running, with the parameters your optimizer holds. Results after a move may differ in the last digits. See TorchScript.
Gymnasium environments (MuJoCo, Box2D and most others, not Atari)breaksAn environment starts over where the job lands: its simulation is at its first step again. Training goes on, with other numbers than an unmoved run's. See Reinforcement learning.
click (a command, a group with commands)movesA program a click command starts pauses and moves inside its function. An open file the command line gave it holds a pause. See Launchers.
typer (typer.run(), a Typer app)movesA program typer starts pauses and moves inside its function. See Launchers.
jsonargparse (auto_cli(), CLI())movesA program started from a function or a class pauses and moves inside it. See Launchers.
Hydra (@hydra.main)movesA program under @hydra.main pauses and moves inside its function, with its configuration, its output directory and its log file. See Launchers.
Hydra sweeps (--multirun)blocksA sweep cannot pause or move. Run each combination as a job of its own. See Launchers.

Hugging Face Trainer

A job that calls trainer.train() pauses inside it, between two steps or in the middle of an evaluation, and continues on the next machine from that point. Nothing runs again: not the model's loading, not the tokenizing, not the steps already made. A moved run ends with the loss, the weights and the log of an unmoved one.

This covers transformers.Trainer and TRL's SFTTrainer, with or without a PEFT LoRA adapter, and sentence-transformers' SentenceTransformerTrainer. Tools that train through them, such as Unsloth and Axolotl, were not run themselves.

sentence-transformers. Its trainer is the Hugging Face Trainer with batch samplers, a data collator and losses of its own. Verified: pairs with MultipleNegativesRankingLoss, the NO_DUPLICATES and GROUP_BY_LABEL batch samplers, BatchAllTripletLoss, and two datasets with a loss each taken in turns. A moved run ends with the loss, the weights and the embeddings of an unmoved one, to the bit. Verified on CPUs with all four and on an NVIDIA GPU with the first. Not verified: the cached losses (CachedMultipleNegativesRankingLoss and the others that keep gradients between passes), evaluators, the cross-encoder and sparse-encoder trainers, and model.fit() of the releases before 3.

What moves with the job:

  • the trainer, the model, the optimizer and the learning rate schedule, mixed precision included;
  • the data loaders at their position, with worker processes if you use them;
  • datasets, callbacks, early stopping and the trainer's log;
  • the checkpoints the trainer saved under the working directory.

Limits:

  • Python 3.12 or later. The job continues from copies of the library's own compiled code, so the next machine needs the same library versions. Your locked requirements give it that.
  • A library that replaces Python's error hook. Comet does so when it is imported, and transformers imports Comet wherever it is installed. Such a job pauses and moves, and an error it ends with is reported through the library's hook as before.
  • A dataset from the library's cache travels by value. load_dataset and map keep rows in Arrow files outside the working directory. Fluid puts those files in the checkpoint and writes them back where the job lands, so the checkpoint grows by the dataset's size and a spot notice must have time for it. Set PORTAL_DATASETS=path in the job's environment to carry paths only: the next machine must then hold the files, for example from your setup command.
  • A streaming dataset moves, with the limits under Fine-tuning.
  • Trackers have their own limits. report_to="tensorboard", "mlflow" and "wandb" (offline) move with the trainer. Each brings the limits of its own section below.
  • Several GPUs: run the script with --ranks N. Fluid starts the trainer's processes, the trainer finds them as it does under torchrun, and they pause and move together. A moved run of two ranks ends with the loss and the weights of an unmoved one, to the bit. Verified on CPUs. A trainer whose processes you start inside the job, with torchrun or accelerate launch, does not pause, and Fluid says so. See Several GPUs.
  • On a GPU. Verified on an NVIDIA GPU and on an Apple GPU: the model, the optimizer's state and the batches are carried from the GPU. On an NVIDIA GPU a moved run ends as an unmoved one, to the bit. See On an NVIDIA GPU.
  • PORTAL_PAUSE_LIBRARY=0 in the job's environment turns pauses inside the trainer off. The job then waits for train() to return, as before.

A training loop you write yourself in PyTorch, with a DataLoader, an optimizer, mixed precision and torch.compile, pauses and moves. See Spot and checkpoints.

Hugging Face Accelerate

A training loop you write over an Accelerator pauses and continues on the next machine. A moved run ends with the losses and the weights of an unmoved one, to the bit.

What moves with the job:

  • what accelerator.prepare() returned: the model, the optimizer, the schedule and the data loader;
  • the Accelerator's settings: the device, mixed precision and the steps gradients are accumulated over. Accelerate keeps these for the whole process, outside your objects, and Fluid carries them;
  • a loop inside with accelerator.accumulate(model):, with accelerator.backward() and accelerator.clip_grad_norm_().

Limits:

  • A pause is taken between two steps, about two seconds after it is asked. A data loader that accelerator.prepare() returned hands out its batches from Accelerate's own code. Fluid first waits two seconds for a pause point of your script's own, then pauses inside that code, in the middle of the epoch, and the job goes on from that step on the next machine. A pause asked during the last batch of an epoch is taken at the first step of the next one. With --ranks N a pause still waits for the end of the epoch: a job with long epochs on several GPUs may not reach that point within a spot notice.
  • Several GPUs: run the script with --ranks N. Fluid starts the processes, the Accelerator finds them as it does under accelerate launch, and they pause and move together. Verified with two processes on CPUs: a moved run ends to the bit. A job that runs accelerate launch or notebook_launcher itself does not pause, and Fluid says so. See Several GPUs.
  • On a GPU. Verified on an NVIDIA GPU in full precision and in float16 mixed precision, and on CPUs with bfloat16: a moved run ends as an unmoved one, to the bit. See On an NVIDIA GPU.
  • Metrics from evaluate. A job pauses in the middle of an evaluation pass, while a metric loaded with evaluate.load() is collecting (metric.add_batch(...) until metric.compute()). The predictions collected so far move with the job, and compute() gives the result of an unmoved run. The metric keeps them in a file under your home directory (~/.cache/huggingface/metrics): on the next machine Fluid makes that directory at the same path, and refuses to land the job, leaving it where it was, if it cannot. A metric made with keep_in_memory=True, with a cache_dir of its own, or with num_process above 1 does not pause while it collects: Fluid says so, and the pause is taken after compute().
  • Not verified: accelerator.save_state() and load_state() across a move, trackers started with accelerator.init_trackers(), accelerator.wait_for_everyone() on CPUs, DeepSpeed and FSDP through Accelerate, and big model inference (dispatch_model, device_map).

Fine-tuning

What a fine-tuning job usually adds around its trainer, and whether it moves.

PartMovesWhat to know
LoRA and other PEFT adaptersYesIn the Hugging Face Trainer, TRL's SFTTrainer or your own loop. The adapter saved at the end is the one an unmoved run saves.
Mixed precision with a gradient scalerYestorch.autocast with torch.amp.GradScaler. The scaler's scale and its per-optimizer state travel. Verified on CPUs with bfloat16 and on an NVIDIA GPU with float16. A loss whose backward starts from a scaled copy of it (scaler.scale(loss).backward(), (loss / steps).backward()) pauses as any other.
A streaming datasetYesload_dataset(..., streaming=True). See below.
Quantized models (bitsandbytes, 8-bit and 4-bit)YesA model loaded with BitsAndBytesConfig and fine-tuned through a LoRA adapter. The quantized weights travel as they are: nothing is quantized again. Verified on an NVIDIA GPU and on CPUs. Quantized embedding layers are not verified.

Streaming datasets. A loop over a streaming dataset pauses at a row and goes on from that row on the next machine. Fluid uses the library's own resume (IterableDataset.state_dict), so nothing the stream already gave is read again. This holds for your own loop, over rows or over the batches of dataset.iter(batch_size=...), for a DataLoader over the stream, and for the Hugging Face Trainer.

  • A shuffle buffer is filled again. shuffle(buffer_size=...) keeps rows in a buffer that is not part of the library's state. After a move, for that pass, a few rows can be skipped or read twice, at most the buffer's size, and the order of the following rows differs from an unmoved run.
  • A function mapped over batches can run once more for the batch of rows the job was in. The rows it gives are the same.
  • With data loader workers the stream is read again from its start up to where the job was. For a stream far into a long run that takes as long as the run did. Use num_workers=0 for a stream on a job that may move.
  • A stream from the network must be reachable from the next machine. Give the job its Hugging Face token as a Fluid secret. A stream over files in the working directory reads them where the job lands. Files somewhere else on the first machine stay there.
  • Needs a datasets release with IterableDataset.state_dict (2.18 or later). With an older one the job waits for the loop to end.
  • With --ranks N, each rank goes on at its own row. A stream split by rank (split_dataset_by_node, or shard by the rank's number) is read once between the ranks, moved or not.

PyTorch Lightning

A job that calls trainer.fit() pauses inside it, between two batches or in the middle of a validation, and continues on the next machine from that point. Nothing runs again. A moved run ends with the metrics, the weights and the checkpoints of an unmoved one. trainer.validate(), trainer.test() and trainer.predict() pause the same way.

This covers the package under both of its names, lightning and pytorch_lightning.

What moves with the job:

  • the trainer, your module, its optimizers and learning rate schedules, with automatic or manual optimization, gradient accumulation and clipping, and mixed precision;
  • the data loaders at their position, with worker processes if you use them;
  • callbacks: ModelCheckpoint with the files it saved and its best scores, EarlyStopping, LearningRateMonitor and your own;
  • loggers: CSVLogger and TensorBoardLogger;
  • the progress bar, tqdm or rich, at its counts.

Limits:

  • Python 3.12 or later. The job continues from copies of the library's own compiled code, so the next machine needs the same Lightning version. Your locked requirements give it that.
  • Several GPUs: run the script with --ranks N. With strategy="ddp" Lightning finds the processes Fluid started and starts none itself. They pause and move together, and a moved run of two ranks ends as an unmoved one, to the bit. Verified on CPUs. Without --ranks, Lightning starts the other processes itself. Such a job runs and does not pause, and Fluid says so. See Several GPUs.
  • Checkpoints and logs under the working directory travel. Lightning keeps absolute paths. Fluid moves a path under the working directory to the working directory of the next machine. A dirpath or save_dir somewhere else stays on the first machine.
  • Loggers that talk to a service are not verified with Lightning: WandbLogger, MLFlowLogger, CometLogger, NeptuneLogger.
  • A callback or module of yours that defines its own pickling keeps it. What its __getstate__ leaves out is not carried.
  • On a GPU. Verified on an NVIDIA GPU and on an Apple GPU. On an NVIDIA GPU a moved run ends as an unmoved one, to the bit, with the trainer and with Fabric. See On an NVIDIA GPU.
  • PORTAL_PAUSE_LIBRARY=0 in the job's environment turns pauses inside the trainer off. The job then waits for fit() to return.

Lightning Fabric. A loop you write with Fabric (fabric.setup, fabric.setup_dataloaders, fabric.backward) pauses at every batch and moves. On several devices, run the script with --ranks N: fabric.launch() then starts no process, and the ranks pause and move together. A launch that starts the processes itself does not pause. The loop can also be in a function you hand to fabric.launch(function): Fabric changes the data loader classes while that function runs, and Fluid has Lightning change them again where the job lands, before your program's values are loaded.

fastai

What was shown, with fastai 2.8 on pandas 2.3 and pandas 3: a tabular learner with Categorify, FillMissing and Normalize, paused inside learn.fit() and moved once and twice, ends with the unmoved run's losses, metric and weights. So does a script that starts with from fastai.tabular.all import *. The model, the optimizer, the data loaders and what the callbacks recorded of the fit so far (the Recorder's losses and learning rates, the progress bars) travel with it.

  • A callback of yours that defines its own pickling (__getstate__, __setstate__) or uses __slots__ keeps it. What it leaves out is not carried.
  • A method your own code registers on one of fastai's dispatched functions (show_batch for a type of yours) holds the pause: where the job lands nothing would register it again.
  • learn.export() and learn.save() are fastai's own and work as before.
  • Not verified: vision and text learners, fit_one_cycle and fine_tune, to_fp16(), distributed training, and a learner on a GPU.

PyTorch Ignite

Fluid pauses inside Engine.run() and continues there on the next machine. The run goes on at the step it stood at, with its data loader where it was, its metrics, its handlers and the engine's state.

Ignite runs an engine inside generators of its own, so that your program can interrupt a run and run it on. Fluid uses the same way out: when a pause is wanted, the engine leaves those generators at the next place Ignite looks for an interrupt, which is after each event of a step, of a batch read and of an epoch. Fluid takes the pause there and drives the run on, here or on the next machine.

  • Your handlers hear nothing of it. No Events.INTERRUPT handler is called for a pause of Fluid's, and run() does not return. An engine.interrupt() of your own works as it does without Fluid.
  • A pause waits for the step under way. It is taken between two events, not inside your process function or a handler.
  • An engine run from a handler runs to its end first. An evaluator you run at the end of an epoch finishes its pass, then the trainer pauses.
  • MONAI's SupervisedTrainer and SupervisedEvaluator are Ignite engines and pause the same way.
  • Random transforms in data loader workers. The run pauses inside its epochs, so a data loader with num_workers above zero and random transforms in its dataset (MONAI's RandCropByPosNegLabeld, RandFlipd) meets the limit of data loader workers there. A move between two epochs is exact, and so is a move within the first 64 batches of an epoch (PORTAL_LOADER_REPLAY=N in the job's environment sets another count). Further into an epoch the workers draw other numbers for the rest of that epoch than an unmoved run's. Workers kept between epochs (persistent_workers=True) are the exception: once they have drawn through an epoch, they draw other numbers after any move, between two epochs too. So does a loader told in_order=False.
  • With PyTorch Ignite before 0.4.11, or with Engine.interrupt_resume_enabled = False, the engine runs without those generators and the run pauses between two lines of its loop.

Verified with PyTorch Ignite 0.5: a trainer over a shuffling data loader with dropout, a metric attached and an evaluator run at the end of each epoch, moved after each kind of event of a run (a step, a batch read, an epoch's start and end, the evaluator's pass), fires the events an unmoved run fires and ends as it does, to the bit.

JAX

A JAX program is a loop of your own around jitted functions, so it pauses at every iteration of that loop and moves. A moved run ends with the losses and the weights of an unmoved one, to the bit on CPUs. For an NVIDIA GPU see the limits below.

What moves with the job:

  • arrays, pytrees of arrays and random keys, old style and typed;
  • jitted functions, compiled again where the job lands;
  • Flax modules and train states, with batch statistics and dropout, in Linen and in NNX;
  • Optax optimizer states, with schedules, clipping and gradient accumulation;
  • the settings you changed with jax.config.update, such as 64-bit mode. Fluid puts them back before any array is loaded.

Limits:

  • A loop inside one compiled call waits. Training written as a single lax.scan or lax.while_loop over all steps is one call into compiled code. A pause waits until it returns. Keep the outer loop in Python.
  • The first step after a move compiles again. Compiled code does not travel.
  • On an NVIDIA GPU JAX's numbers vary from run to run, moved or not. Two unmoved runs of the same 32-bit training differed from each other by 0.1% to 0.3% after 2,500 steps on some runs and agreed to the bit on others, and a moved run differed from them by as much. With XLA_FLAGS=--xla_gpu_deterministic_ops=true every run is the same to the bit, and so is a moved one. Set it with --env, so that every machine has it.
  • Arrays travel through the machine's memory. A JAX array on a GPU is copied to memory for the checkpoint and back to a GPU where the job lands.
  • A setting changed through an environment variable (JAX_ENABLE_X64) must be set for the job, with --env, so that every machine has it.
  • A pause waits for a Flax call to return. Flax tracks a module's call in the thread itself, so Fluid takes no pause inside model.init or an apply that is not jitted. It pauses at your loop's next iteration.
  • One device. A job that places arrays over a mesh of devices (jax.make_mesh, jax.sharding, pmap) or joins jax.distributed does not pause, and Fluid says so from the moment it makes the mesh. JAX's own saving of an array drops where it was placed, so a moved step would fail or run on one device. Keep the arrays on one device, with no mesh, and the job pauses and moves.

Keras

Keras 3 runs model.fit() as a loop over batches, whatever backend computes the step. A job pauses inside it, between two batches, and continues on the next machine. evaluate() and predict() pause the same way. A moved run ends with the history and the weights of an unmoved one, to the bit on CPUs.

This is verified on all three backends: PyTorch, JAX and TensorFlow.

What moves with the job:

  • the model, Sequential, functional or of your own class, with batch normalization and dropout;
  • the optimizer with its state and learning rate schedule, the loss and the metrics with the epoch's running means;
  • callbacks: ModelCheckpoint, EarlyStopping, CSVLogger, TensorBoard, the history and your own;
  • the step function, which Keras makes again where the job lands;
  • layers that add a loss of their own with self.add_loss in call. On the TensorFlow backend the loss a layer keeps between steps belongs to the compiled step and is made again with it, so model.losses is empty between the move and the next step.

Limits:

  • Python 3.12 or later, and the same Keras version on the next machine.
  • Keras 3 only. Legacy Keras 2 (tf_keras, which is what tf.keras means when TF_USE_LEGACY_KERAS=1 is set) is not carried. It saves a model as a new model with new variables, so an optimizer or a paused training loop that holds the old ones would fail on the next machine, and it does not save the function of a Lambda layer. A job that makes a legacy model or optimizer is therefore not checkpointed, and Fluid says so when the model is made. Use Keras 3: leave TF_USE_LEGACY_KERAS unset, and where the code imports tf_keras itself, import keras instead. The job then pauses and moves.
  • Choose the backend for the job, not in code. Set KERAS_BACKEND with --env, so that every machine has it.
  • The first batch after a move compiles again on the JAX backend.
  • One process on one device. A model under a tf.distribute strategy or under keras.distribution does not pause, and Fluid says so. Train without one and the job pauses and moves.
  • Input. NumPy arrays are verified on every backend, and a tf.data pipeline on the TensorFlow backend. PyTorch data loaders and Keras PyDataset inputs go through the same loop and are not tested.
  • A tf.data pipeline that reshuffles each epoch (the default of shuffle) goes on exactly in the epoch it was paused in. The epochs after a move are shuffled from the seed's start again: every row is still read once an epoch, in another order than an unmoved run's. With reshuffle_each_iteration=False, or NumPy input, a moved run matches an unmoved one.
  • A mixed precision policy (keras.mixed_precision.set_global_policy("mixed_float16")) moves with the job, on all three backends: the fit goes on under it and ends as an unmoved run does. Verified on CPUs.
  • On an NVIDIA GPU all three backends are verified. On the PyTorch backend a moved run ends as an unmoved one, to the bit. On the JAX and TensorFlow backends Keras's numbers vary from run to run, moved or not, by up to 0.4% in the tests. They are the same to the bit, moved or not, with JAX's XLA_FLAGS=--xla_gpu_deterministic_ops=true or TensorFlow's tf.config.experimental.enable_op_determinism(), which Fluid carries to the next machine.
  • PORTAL_PAUSE_LIBRARY=0 turns pauses inside fit() off. The job then waits for it to return.

TensorFlow

A TensorFlow program is a loop of your own around tf.function steps, so it pauses at every iteration and moves. A moved run ends with the losses and the weights of an unmoved one, to the bit, on CPUs and on an NVIDIA GPU. Keras on the TensorFlow backend is under Keras.

What moves with the job:

  • variables and tensors, by their values;
  • functions wrapped by tf.function, as the Python function and its options. TensorFlow traces them again at their first call on the next machine;
  • tf.Module objects and Keras optimizers;
  • a model loaded with tf.saved_model.load or tensorflow_hub.load: its files travel with the job and TensorFlow loads it again on the next machine, with the variables you trained since. The variables and functions you keep beside it stay the model's own;
  • a tf.data dataset and its iterator, by TensorFlow's own saving of an input pipeline: the position, the shuffle buffer and the seeds. The loop goes on with the batch an unmoved run would read next;
  • random numbers from a tf.random.Generator, whose state is a variable;
  • the seed you set with tf.random.set_seed or keras.utils.set_random_seed: what the script draws after a move, the weights of a model it makes there and the order of a shuffle it starts there are the ones an unmoved run gets;
  • the switches of the whole process you turned on: tf.config.experimental.enable_op_determinism(), tf.config.run_functions_eagerly(True) and tf.config.optimizer.set_jit(...). Fluid turns them on again before anything is loaded.

Limits:

  • Random augmentation with no seed draws fresh numbers after a move. A random operation inside map that sets no seed (tf.image.random_flip_left_right, tf.random.uniform) gets its seed from the system each time the pipeline is made, so two runs of your script already draw differently. After a move the pipeline goes on from the row it stood at, with its shuffle buffer and the rows it had read ahead, and those operations draw from a new random stream. No row is read twice and none is skipped. The move's event says so. Set PORTAL_TFDATA_FRESH_RANDOM=0 in the job's environment and such a job is not checkpointed instead.
  • A pipeline that reads files needs them in the working directory. Fluid carries the pipeline, not the files it reads. A TFRecordDataset, TextLineDataset or tf.io.read_file over files named by a path relative to the working directory moves, because the working directory travels with the job. Files anywhere else, such as TensorFlow Datasets' default directory under your home, are not on the next machine, so a job that holds such a pipeline is not checkpointed, and Fluid names the file. Keep the data in the working directory and name it by a relative path: tfds.load(..., data_dir="data"), tf.data.TFRecordDataset("data/train.tfrecord"). An absolute path is refused even under the working directory, which is somewhere else on another machine. A file you reach through a symbolic link moves only when the link is relative and stays inside the working directory. A cache kept in files (cache("cache/train")) moves once the pipeline has been read to its end for the first time. While TensorFlow is still writing the cache, the job is not checkpointed. Names of another store (gs://, s3://) are fine. If the files are on every machine by the same path, such as a shared mount, set PORTAL_TFDATA_OUTSIDE_FILES=1 in the job's environment.
  • A pipeline that reads files needs them in the working directory. Fluid carries the pipeline, not the files it reads. A TFRecordDataset, TextLineDataset or tf.io.read_file over files named by a path relative to the working directory moves, because the working directory travels with the job. Files anywhere else, such as TensorFlow Datasets' default directory under your home, are not on the next machine, so a job that holds such a pipeline is not checkpointed, and Fluid names the file. Keep the data in the working directory and name it by a relative path: tfds.load(..., data_dir="data"), tf.data.TFRecordDataset("data/train.tfrecord"). An absolute path is refused even under the working directory, which is somewhere else on another machine. Names of another store (gs://, s3://) are fine. If the files are on every machine by the same path, such as a shared mount, set PORTAL_TFDATA_OUTSIDE_FILES=1 in the job's environment.
  • Keras random layers inside map hold the job where it is. keras.layers.RandomFlip, RandomCrop and the other random layers keep a seed counter in a variable, and a pipeline that calls one inside map cannot be saved with the layer it shares that counter with. A job that holds such a dataset is not checkpointed, and Fluid says why. Call the layers inside the model, or use tf.image.random_flip_left_right and the other tf.image operations in map.
  • A pipeline TensorFlow cannot save does not move. from_generator, py_function, a variable read inside map and a random operation inside map that has a seed (its own, or tf.random.set_seed) hold state outside the pipeline. A seeded draw repeats from run to run, and Fluid does not restart its stream behind your back. A job that holds such a dataset is not checkpointed, and Fluid says why. Use the stateless random operations (tf.random.stateless_uniform, tf.image.stateless_random_flip_left_right) or read through TensorFlow's own readers.
  • Stateful random operations start again. tf.random.normal and tf.nn.dropout without a generator draw from a stream that TensorFlow keeps inside the traced function. After a move the stream starts again, so the numbers differ from an unmoved run's. Use a tf.random.Generator or Keras layers for a run that must match.
  • The first step after a move traces again.
  • No distribution strategy. A job that trains under a tf.distribute strategy (MirroredStrategy, MultiWorkerMirroredStrategy, OneDeviceStrategy and the others) does not pause, on one device either: TensorFlow cannot save a strategy's variables and iterators. Fluid says so when the strategy is made. Train without a strategy and the job pauses and moves.
  • TensorFlow 1 style graphs and sessions are not covered.

Gradient boosting

XGBoost moves. XGBoost runs its boosting rounds in a Python loop, so a job pauses between two rounds, inside xgboost.train(), xgboost.cv() or the scikit-learn fit(), and continues on the next machine. The model at the end is the one an unmoved run trains, byte for byte, with row and column sampling too.

  • A DMatrix travels by value. Fluid writes it in XGBoost's own binary form into the checkpoint. The checkpoint grows by the matrix's size, and a pause takes as long as writing it. On spot, a large matrix may not fit in the notice.
  • A QuantileDMatrix is made again from its data. The scikit-learn interface trains on one, and XGBoost cannot save it. Fluid makes it again from the data it was made from, which gives the same model. Your program must still hold that data: model.fit(X, y) does, for the length of the call. If the data is gone, the job does not pause and says why.
  • One process. Dask, Spark and multi-GPU training are not covered.
  • On an NVIDIA GPU (device="cuda") a moved run's losses and predictions agree with an unmoved run's to seven digits, not to the last bit, although two unmoved runs agree to the bit.
  • Python 3.12 or later, and the same XGBoost version on the next machine.

LightGBM waits for a fit. A fit is one call into LightGBM's own code, and LightGBM cannot save a booster in training with the data it trains on. A pause waits until train() or fit() returns.

  • The job pauses and moves before and after a fit, with its datasets and boosters. A constructed Dataset used to block every checkpoint of a job that held one.
  • On a GPU (device_type="gpu") LightGBM's own runs differ from one another in their last digits, moved or not: two unmoved runs of the tests differed by up to 0.3%, and a moved run by as much.
  • To make a long fit safe, train in several calls. Each call goes on from the last one's model, and the job pauses between two calls:
train = lgb.Dataset(X, label=y, free_raw_data=False)
booster = None
for _ in range(20):
    booster = lgb.train(params, train, num_boost_round=50, init_model=booster)

With deterministic=True and no bagging, the trees are the ones a single fit of 1,000 rounds grows, moved or not. free_raw_data=False is needed: LightGBM continues from a model only on a dataset that still has its raw data.

CatBoost waits for a fit. A fit is one call into CatBoost's own code. A pause waits until fit() returns.

  • The job pauses and moves before and after a fit, with its pools and models. A Pool used to block every checkpoint of a job that held one.
  • A pool with categorical, text or embedding features cannot move. CatBoost gives back only a hashed form of them. Drop the pool before a pause point and make it again after, or quantize it (pool.quantize()), which Fluid carries as CatBoost's own file.
  • A model that moved keeps its trees and settings. The record of its fit's evaluations (evals_result_) is not kept, as with CatBoost's own pickling.
  • On an NVIDIA GPU (task_type="GPU") a job moves around its fit the same way, and ends as an unmoved one, to the bit.
  • A fit continued with init_model= grows other trees from a model that was saved and loaded than from one still in memory. That is CatBoost's own behaviour, so Fluid does not promise the same trees for a fit made in several calls.

TensorBoard

A job with a SummaryWriter open pauses and moves. This covers torch.utils.tensorboard, tensorboardX, a writer of TensorFlow's tf.summary.create_file_writer, Flax's flax.metrics.tensorboard.SummaryWriter and the writers of clu.metric_writers.

  • Fluid flushes the writer at the pause, so everything logged before it is in the event file.
  • Where the job lands the writer opens a new event file in the same log directory. TensorBoard reads the files of one directory as one run, so the charts have no gap and no repeated step.
  • Keep the log directory under the working directory. The working directory travels with the job, and a log directory given as an absolute path under it follows it. A log directory somewhere else stays on the first machine, and the next machine starts an empty one at the same path.
  • A writer you closed stays closed.
  • TensorFlow's default writer travels too. After writer.set_as_default(), tf.summary.scalar writes to the same writer where the job lands, with the step you set.
  • A clu writer finishes its writes first. create_default_writer hands each write to a thread of its own. A pause waits until those writes are done, which takes milliseconds, so nothing you logged is dropped.
  • Not covered: a TensorFlow writer made in graph mode, over a DTensor mesh or with experimental_trackable=True. A job that holds one does not pause.
  • With --ranks N, each rank's writer goes on in the same log directory. Verified on CPUs.

MLflow

A job with a run active pauses and moves, inside with mlflow.start_run(): too.

  • Where the job lands Fluid starts the active runs again by their ids, in their order, with mlflow.start_run(run_id=...). Nested runs come back nested. The next log_metric goes to the same run.
  • The tracking store must be reachable from the next machine. A tracking server is. So is a file under the working directory, such as sqlite:///mlflow.db. A file somewhere else on the first machine is not.
  • The tracking location and the experiment travel in the job's environment, where MLflow keeps them. Credentials for a tracking server do not travel in a checkpoint: give them to the job as Fluid secrets.
  • With --ranks N, a run that every rank joined by its id goes on in every rank. Verified on CPUs with a store in the working directory.
  • Autologging goes on where the job lands. mlflow.autolog() and one library's call, such as mlflow.sklearn.autolog(), change that library's classes for the whole run; Fluid has MLflow turn each on again, with the arguments you gave it, before your program's values are loaded. Verified with scikit-learn, with a store in the working directory.
  • Not verified: system metrics logging and asynchronous logging. Each starts a background thread.

Weights & Biases

A job with a run open pauses and can be checkpointed. Before, an open run blocked every checkpoint.

  • Where the job lands Fluid continues the run with wandb.init(id=..., resume="allow"), which is W&B's own way to continue a run after an interruption. The run keeps its id, project, entity, name, group, job type, tags, notes and config. wandb.log goes on, whether or not your program kept the run object.
  • Offline runs are verified. The job continues in a second run directory with the same id, and its steps go on from where they were. Each machine's directory is under the working directory, for wandb sync. Whether W&B joins the two directories into one run when you sync them is not verified.
  • Runs that log to W&B's servers are not verified yet. They continue the same way. What W&B's servers show for a run that two machines wrote in turn has not been checked.
  • with wandb.init(...) as run: around your training. Offline, the job pauses inside the block. Where it lands the block is entered again over the same run continued: its id, name and config, its summary with what you set and what you last logged, its steps going on. Leaving the block finishes the run, once. With a run that logs to W&B's servers the block still holds the pause: that waits for the online runs to be verified.
  • A run you finished cannot move while your program still holds it. Drop the reference, or pause before run.finish().
  • Settings you passed to wandb.init in code, other than the ones listed above and dir, are not carried. Set them through W&B's environment variables, which travel with the job.
  • A row logged with commit=False and not committed before the pause is written by both machines, each with its part.
  • With --ranks N, an offline run in each rank continues in each rank.
  • Give the job its API key as a Fluid secret. Keys do not travel in a checkpoint.

Comet

A job with a Comet experiment open is not paused, moved or saved on a spot notice. The experiment keeps the file it writes its messages to and threads of its own that write and send them, and a checkpoint does not carry those yet.

  • Fluid runs the job. It starts and finishes as it would anywhere, and the experiment is logged whole.
  • Fluid says so from the start. The plan warns when your requirements name comet-ml. The job gets an event when your program opens an experiment, and every pause asked for is refused by the library's name. Before, such a job took the pause and its checkpoint then failed.
  • On spot, a notice loses the work since your own last save. Run these jobs on an on-demand machine, or log with TensorBoard or MLflow, whose runs move with the job.
  • Only while an experiment is open, with Comet's automatic logging off. Set COMET_DISABLE_AUTO_LOGGING=1 (--env COMET_DISABLE_AUTO_LOGGING=1). Once your program has ended every experiment it opened (experiment.end()), the job then pauses and moves again, and a new experiment blocks again. With automatic logging on, which is Comet's default, the job stays refused after the experiment is ended: Comet has wrapped functions of the libraries it logs from, and a checkpoint taken then could not be continued on another machine. Drop the ended experiment too: one your program still holds in a variable cannot be carried, and a checkpoint is then refused by that variable's name.
  • Verified with an offline experiment (comet_ml.OfflineExperiment), which needs no account. An experiment that sends to Comet holds the same files and threads, and connections besides; it was not run.

Importing comet_ml blocks nothing: transformers imports it wherever it is installed, and a job that opens no experiment pauses as any other.

Comet beside MLflow. Where both are installed and Comet is imported before MLflow, Comet opens an experiment of its own for every MLflow run, an offline one when it has no API key, and takes the job's output for it. Your job then holds a Comet experiment it never asked for and is refused like any other. Set COMET_DISABLE_AUTO_LOGGING=1 (--env COMET_DISABLE_AUTO_LOGGING=1), or leave comet-ml out of the job's requirements: the MLflow run then moves with the job. Verified both ways.

Neptune

A job with a Neptune run open is not paused, moved or saved on a spot notice, for the same reason as Comet: the run keeps the files it queues its operations in and threads of its own that write and send them.

  • Fluid runs the job, and the run is logged whole.
  • Fluid says so from the start. The plan warns when your requirements name neptune. The job gets an event when your program opens a run, and every pause asked for is refused by the library's name. Before, such a job took the pause and its checkpoint then failed.
  • On spot, a notice loses the work since your own last save. Run these jobs on an on-demand machine, or log with TensorBoard or MLflow, whose runs move with the job.
  • Only while a run is open. Once your program has stopped every run it opened (run.stop(), or run.close() with neptune-scale), the job pauses and moves again, and a new run blocks again. Drop the stopped run too: one your program still holds in a variable cannot be carried, and a checkpoint is then refused by that variable's name.
  • Verified with an offline run (neptune.init_run(mode="offline")), which needs no account. A run that sends to Neptune was not run, and neither was neptune-scale.

matplotlib

A job that draws with matplotlib moves with its figures.

  • The figures your program holds and the ones only pyplot holds both move, under their numbers. A script that draws with plt.plot(...) over many steps and saves at the end gets the whole figure, also the part drawn before a move. plt.figure(2) is the same figure after it.
  • The settings you changed move too: plt.rcParams[...], plt.style.use(...). A figure made after a move is drawn with them.
  • 3D axes move too, with the lines and the scatters drawn on them (ax.scatter on projection="3d"), before and after the figure is drawn.
  • A 3D surface or 3D bars hold a job where it is once the figure has been drawn. plot_surface and bar3d move while the figure has not been drawn yet. After a draw (savefig, fig.canvas.draw(), plt.show()) the job is not checkpointed while it keeps that figure, and Fluid says why. Close the figure when it is saved (plt.close(fig)).
  • The backend is chosen again where the job lands. A choice made with matplotlib.use(...) is not carried. A machine with no display draws with Agg, which is what a training job needs. For another backend, name it in the job's environment: --env MPLBACKEND=pdf. Every machine of the job starts with it.
  • Callbacks connected to a figure (fig.canvas.mpl_connect) are left out, as matplotlib's own pickling leaves them out. Connect them again after a move if you need them.
  • A pause waits for a figure to finish drawing or saving. While savefig (or a draw) runs, matplotlib lends the figure a canvas and settings of the call's own, so a pause asked then is taken right after the call returns.

GPU-only libraries

CuPy, RAPIDS, vLLM and SGLang compute on an NVIDIA GPU only. CuPy and RAPIDS are verified there. vLLM and SGLang have not been moved yet.

CuPy moves. A CuPy program is a loop of your own over arrays the GPU holds, so it pauses at every iteration and moves. A moved run ends as an unmoved one, to the bit.

What moves with the job:

  • arrays, and the state of a generator (cupy.random.default_rng);
  • sparse matrices and the other objects of cupyx.scipy;
  • kernels the program compiled: ElementwiseKernel, ReductionKernel, RawKernel and RawModule. CuPy compiles them again at their first call on the next machine.

Limits:

  • Arrays travel through the machine's memory. They are copied off the GPU for the checkpoint and back onto a GPU where the job lands. The machine needs memory for them, and a spot notice must have time for them.
  • The next machine needs an NVIDIA GPU. A CuPy job cannot land on a machine without one.
  • A compiled function taken out of a module cannot move. RawModule.get_function(...) gives a handle to code loaded on one process's GPU. A job that holds one is not checkpointed, and Fluid says why. Keep the RawModule and take the function again after a pause point.
  • Not verified: cupy.fuse, cupyx.jit, streams and memory pools of your own, and arrays on a second GPU.

RAPIDS cuDF moves. A loop of your own over data frames, series and indexes pauses at every iteration and moves, string columns and the results of group-by and merge included. A moved run ends as an unmoved one, within what two unmoved runs differ by: cuDF's group-by sums differ in their sixteenth digit from one run to the next. The limits are CuPy's first two: tables travel through the machine's memory, and the next machine needs an NVIDIA GPU. Dask-cuDF and cudf.pandas are not verified.

RAPIDS cuML waits for a fit. A fit is one call into cuML's own code, so a pause waits until it returns. The job pauses and moves before and after it, with its fitted models: linear regression and k-means are verified. cuML's own fits differ from one run to the next in their last digits on some runs, moved or not.

vLLM and SGLang are not verified. Each keeps its model on the GPU inside an engine with threads or processes of its own.

  • Fluid runs the job. Nothing about these libraries stops a job from starting or finishing.
  • A move, a suspend or a spot checkpoint may be refused. The checkpoint check reports within the first minutes what a checkpoint of your job could not carry. fluid status JOB shows it.
  • On spot, a job that cannot be checkpointed loses its work at a notice. Nothing of a lost machine is saved. Run such a job on an on-demand machine, or write results to storage of your own as you go and make the script skip what is done when it starts again.

scikit-learn and skorch

scikit-learn. Most of a scikit-learn job is one call into compiled code: fit() on an estimator. A pause waits for that call to return. What moves is a loop of your own over such calls, with everything fitted so far. Verified, each to the bit against an unmoved run:

  • a linear model fitted batch by batch with partial_fit, on data scaled by a fitted StandardScaler;
  • a RandomForestClassifier grown a few trees at a time with warm_start=True;
  • a Pipeline fitted and scored once per fold of a KFold.

A job that is a single long fit() has no place to pause before it returns. If you run on spot, split the work into calls: fit in rounds with warm_start, or loop over the folds and candidates yourself. Not verified: a pause inside a search or a cross-validation of the library's own (GridSearchCV, cross_val_score), and fits that run in worker processes (n_jobs).

skorch. A net's fit() runs the loop inside skorch, and a pause stops in the middle of an epoch. The net moves with its module, optimizer and history, and with what its callbacks keep for the fit under way: a progress bar's bar of the epoch, a learning rate scheduler's schedule, early stopping's copy of the best weights. A moved fit ends after the same epochs, with the same losses and rates, on the best epoch's weights. A history kept in a store (DistributedHistory over torch's TCPStore) moves when the job's own process serves the store and nothing else is connected to it, as in skorch's example: the store is made again where the job lands, with the keys it held. A store that another process or a second store object is connected to cannot move: Fluid says so by name and the job stays where it is. Not verified: a net inside a scikit-learn search that fits in worker processes.

spaCy

A spaCy pipeline (spacy.load(...), or spacy.blank(...) with components) moves with your job, wherever your program holds it: in a variable, inside a function that closes over it, or in a functools.partial, as a collate function that tokenizes does.

  • How it travels. Fluid saves the pipeline the way spaCy does (nlp.to_disk): its config, its meta, the vocabulary, the tokenizer and every component's weights and tables. Where the job lands the pipeline is loaded from those files, as spacy.load loads one. The strings it has seen so far travel with it.
  • What that adds to a checkpoint. The pipeline's own files and nothing else. For en_core_web_sm that is 15 MB, read in about 0.2 seconds when the job is saved and loaded in about 0.5 seconds where it lands.
  • Your own components and extensions. A component your script registered (@Language.component, @Language.factory) and the extensions it set on Doc, Span and Token are registered again where the job lands.
  • Model packages. A pipeline loaded from a package (en_core_web_sm) needs the same package, in the same version, on the machine the job lands on. If it is missing or another version, Fluid refuses that machine by the package's name and the job stays where it is. Put the package in your project's requirements.
  • What cannot move. A pipeline whose weights are on a GPU (spacy.require_gpu()), and a pipeline your program set an attribute of its own on (nlp.my_data = ...), which spaCy's save does not write, and a pipeline with a component of your own that keeps state and has no to_disk (spaCy would make it anew, without its state). Fluid says which when it saves the job, and the job goes on where it is. Keep such data in a variable beside the pipeline.
  • Not carried. nlp.path, the directory the pipeline was loaded from, is None after a move.
  • Not verified. Training in the loop (nlp.update), transformer pipelines, and a Doc, a Vocab or a tokenizer your program holds apart from its pipeline.

Verified with a blank English pipeline (a sentencizer, a trained tagger, an entity ruler, a component and an extension of the script's own) moved twice: every text after each move gives the tokens, tags, sentences, entities and scores of an unmoved run, to the last digit. The same with en_core_web_sm 3.8.0 moved twice, on a machine that has the package.

Model libraries

timm, MONAI, PyTorch Geometric and Diffusers give you models, losses, transforms and schedules, and you write the loop. Nothing in them runs the loop, so your job pauses at every iteration, as any loop of your own does. What a move has to carry is their objects, and it does: a moved run ends as an unmoved one, to the bit.

timm. Verified: a model from timm.create_model, an optimizer from create_optimizer_v2, CosineLRScheduler with warmup, the averaged model ModelEmaV3, and Mixup with SoftTargetCrossEntropy. Mixup draws from NumPy's global generator, whose state travels. Not verified: timm's own train.py script, and its loader with a prefetcher (create_loader).

MONAI. Verified: UNet, DiceLoss, a Dataset and a CacheDataset with random dictionary transforms, MONAI's DataLoader, sliding_window_inference and DiceMetric. The transforms' random state travels, so the batches after a move are the ones an unmoved run draws. Limits:

  • A cached dataset travels by value. What CacheDataset computed once is in the job's memory and goes into the checkpoint, which grows by its size.
  • MONAI's engines (SupervisedTrainer, SupervisedEvaluator) are PyTorch Ignite engines and pause as those do. See PyTorch Ignite.
  • Not verified: PersistentDataset, SmartCacheDataset, the bundle workflows and MONAI Label.

PyTorch Geometric. Verified: GCNConv, GATConv and SAGEConv layers, global_mean_pool, the library's DataLoader over a list of graphs, shuffled, and its TemporalDataLoader over a stream of timed events, with negative sampling. A graph layer pickles by a rule of the library's own, which Fluid accounts for: before, a job holding a graph model was refused its move. Layers that torch_geometric.explain ran over move too, and so does a layer class of your own (a subclass of MessagePassing) when it is defined in a module beside your script and imported. A layer class defined in the script itself cannot move: Fluid says so by the class's name when it checks the job, and the job stays where it is. Not verified: neighbor sampling (NeighborLoader, LinkNeighborLoader), which needs the compiled extensions pyg-lib or torch-sparse, heterogeneous graphs, and torch_geometric.compile.

Diffusers. Verified: a UNet2DModel, DDPMScheduler and DPMSolverMultistepScheduler, a DDPMPipeline, and the averaged weights of EMAModel, in three kinds of loop:

  • Calls of a pipeline in a loop. The job pauses between two calls. A pause waits for the call that is running: Fluid does not stop inside a pipeline's own denoising loop yet, so one call's images are the longest wait. Generate in batches small enough to fit your machine's notice.
  • A denoising loop you write over scheduler.timesteps with scheduler.step(). The job pauses between two steps, and a multistep solver's kept model outputs travel.
  • A training loop with scheduler.add_noise() and EMAModel.

Every model, scheduler and pipeline keeps its configuration in a dictionary of the library's own, which Fluid accounts for: before, a job holding any of them was refused its move. Not verified: Stable Diffusion and the other large pipelines with their text encoders, LoRA loading, enable_model_cpu_offload() and the other memory hooks, and compiled models.

All four are verified on CPUs and on an NVIDIA GPU, where a moved run ends as an unmoved one, to the bit. Convolutions and sums by index have more than one way to be computed on a GPU, and PyTorch picks the same one every run only when told: the GPU runs had torch.use_deterministic_algorithms(True) on (MONAI's set_determinism() for MONAI). Without it two unmoved runs can differ in their last digits, and a moved one by as much. See On an NVIDIA GPU.

A script that asks the Hub again after a move. Hugging Face libraries keep what they download in a cache under your home directory, which does not travel: only the working directory does. The model your script loaded is in memory and moves with it. A script that loads from the Hub again later needs the Hub to answer on the new machine, and Diffusers' training examples all do, at their end, to save the trained pipeline. If the Hub does not answer at that minute, the job fails at its last step, where an unmoved run would have read its cache.

--env PORTAL_HUB_FETCH=1 moves that risk to the restore. The checkpoint then carries the names of the files your job downloaded (repository, exact revision, file names; no model bytes), and Fluid downloads them again on the new machine before the job goes on, with your job's own HF_TOKEN for gated models. If one cannot be fetched, the restore is refused and the job stays where its checkpoint is. It is off by default for now because it lengthens every restore by the download: about a second for small models in our measurements, and one to two minutes in 5 of 73 restores when the Hub answered slowly.

Ultralytics YOLO

model.train() runs the whole training loop inside the library. Fluid pauses inside it, between two statements of the trainer's loop, and the job goes on from that batch where it lands. Verified on CPUs with a detection model built from the library's own description: a run moved once or twice in the middle of training ends as an unmoved one, to the bit, with every epoch's row of results, the final validation and the saved weights.

  • What travels. The trainer with its model, the averaged weights (EMA), the optimizer and its schedule, the datasets with their augmentations, the validator, and the data loader's one iterator, which the library keeps for every epoch.
  • Paths follow the job. The library keeps the absolute path of its run directory, of the weights it saves and of every picture and label file. Those under your working directory are carried by their place in it, so the job reads its pictures and writes results.csv, last.pt and best.pt under the working directory of the machine it lands on. Keep your dataset under the working directory: a dataset somewhere else on the first machine is not on the next one.
  • Settings. What your job changed in ultralytics.settings is set again where it lands.
  • Loader workers. With workers above 0 the pictures are augmented in worker processes, each from a random stream of its own. After a move new workers start new streams: the training goes on and ends as a training does, with other augmentations than the unmoved run's from there. With workers=0 the augmentations are the unmoved run's.
  • Not verified: training on several GPUs, which the library starts in processes of its own (a move may wait until train() returns), mixed precision on a GPU, and the trackers the library reports to when their package is installed (MLflow, TensorBoard, Comet, W&B and others). Turn a tracker off with settings.update({"mlflow": False}) if you do not use it.

ONNX Runtime

ONNX Runtime moves. A loop of your own that runs batches through an InferenceSession pauses at every iteration. A session is a handle to a model loaded on one machine, so Fluid carries what made it and makes it again where the job lands: the model, the session options and the providers. Every batch's output is an unmoved run's, to the bit, on the CPU provider and on the CUDA provider.

What moves with the job:

  • a session made from a file's path or from the model's bytes;
  • session options, with the attributes you set (thread counts, the optimization level, the execution mode and the rest) and configuration entries (add_session_config_entry). Dimension overrides and custom operator libraries are carried the same way and have not been run;
  • the providers and provider options you gave, in your order.

Limits:

  • The model is loaded again. Where the job lands, ONNX Runtime loads and optimizes the model once more, for that machine. A large model adds its load time to the move.
  • Keep the model file under the working directory, which travels with the job. A session whose file is somewhere else is not checkpointed, and Fluid says which file. A relative path, a path under the working directory, or the model's bytes all move.
  • Not carried: an IO binding (session.io_binding()), an OrtValue, run options, the objects session.get_inputs() returns, and session options given add_initializer() or add_provider(). A job that holds one of these is not checkpointed, and Fluid names the variable. Keep the input names, not the objects, and make a binding again after a pause point.
  • The providers must exist on the next machine. A session made for CUDAExecutionProvider needs a machine with an NVIDIA GPU and the same onnxruntime-gpu. Verified on the CPU provider and on the CUDA provider, where the outputs after a move are an unmoved run's, to the bit. The TensorRT provider has not been run.
  • A profile ONNX Runtime writes (enable_profiling) starts a new file where the job lands.

Optuna moves. A search is a loop over trials. Your job pauses in it and continues on the next machine with the study, its sampler and its pruner. The search then runs the trials an unmoved one runs: every trial's parameters, value and state are the same, to the bit, with a seeded sampler.

  • A loop you write. trial = study.ask(), your training, study.tell(trial, value). The job pauses between two trials, or inside your training wherever your own code pauses.
  • study.optimize(). Fluid pauses inside the call, between two statements of Optuna's loop or of your objective. An objective that reports as it goes (trial.report, trial.should_prune) is pruned as in an unmoved search.

Limits:

  • Where the study is kept. A study in memory travels with the job. A study in a database file (sqlite:///study.db) travels when the file is under the working directory. A study on a database server must be reachable from the next machine, as it is from the first.
  • n_jobs above one waits. Optuna then runs the trials in a pool of threads that its loop holds, and a pause waits until optimize() returns. Keep n_jobs=1, which is Optuna's default, for a search that has to move.
  • A trial that runs when the job moves is not run twice. It continues where it stopped: your objective's own loop goes on from its iteration.
  • Not verified: the journal and gRPC storages, the CMA-ES and Gaussian process samplers, optuna.integration callbacks, and several jobs sharing one study during a move.
  • PORTAL_PAUSE_LIBRARY=0 in the job's environment turns pauses inside optimize() off. The job then waits for it to return.

Ray Tune runs its trials on a Ray cluster: see Ray, Dask and Spark. W&B sweeps are not verified.

Ray, Dask and Spark

Ray, Dask's distributed scheduler and Spark each run a cluster of their own beside your script: a scheduler and workers in other processes, with the data and results they hold. Your script holds a connection to them. A checkpoint of your script does not hold those processes, so a job that uses one of them is not paused, moved or saved on a spot notice.

  • Fluid runs the job. It starts and finishes as it would anywhere.
  • Fluid says so from the start. The plan warns when your requirements name ray, distributed or pyspark. The job gets an event when your program calls ray.init() (Ray Train, Tune and Data call it for you), makes a Dask Client or cluster, or starts a Spark session.
  • A pause is refused by the library's name. The job takes no pause, so a move or a suspend you ask for does not go through and the job goes on where it is. The checkpoint check reports the library's sentence within the first minutes, and fluid status JOB shows it.
  • On spot, a notice loses the work since your own last save. Run these jobs on an on-demand machine, or save with the library's own checkpoints (Ray Train and Tune write them) and make the script continue from them when it starts again.

Dask without a client moves. Dask collections computed on the threads of your job's own process hold nothing outside it. Set dask.config.set(scheduler="threads"), make no Client, and the job pauses between two computes and moves with the collections it keeps. A moved run ends as an unmoved one, to the bit. This is verified with Dask arrays.

Importing one of these libraries blocks nothing. A job that imports ray or pyspark and never starts a cluster pauses as any other.

MMEngine

MMEngine's Runner runs the training loop of MMDetection, MMSegmentation, MMPose, MMPretrain and the other OpenMMLab libraries. Fluid pauses inside runner.train(), between two iterations, and the job goes on at the next batch where it lands. Nothing runs again.

  • What travels. The Runner with its training and validation loops, its hooks, the optimizer wrapper and its schedules with their counters, the logger, the message hub and the visualizer. The library's "current" logger and message hub are the Runner's own where the job lands, as they were.
  • One log, one set of checkpoints. The work directory under your working directory travels with the job. The text log and scalars.json are appended to, each step once, and last_checkpoint names a file under the working directory of the machine the job is on.
  • Both kinds of loop. A loop that counts epochs (EpochBasedTrainLoop), and one that counts iterations over a sampler that never ends (IterBasedTrainLoop with InfiniteSampler), with or without loader workers. A moved run trains on the batches of an unmoved one.
  • Verified with a real Runner on CPUs: a classifier with a validation metric, a step schedule, CheckpointHook and LoggerHook, moved once and twice in the middle of an epoch, ends with the counters, the logged steps, the checkpoints, the validation figures and the weights of an unmoved run, to the bit.
  • Not verified: the models, hooks and datasets of MMDetection and the other libraries themselves, several GPUs (launcher), mixed precision (AmpOptimWrapper) on a GPU, and the visualizer's TensorBoard and W&B backends. If your Runner holds something Fluid cannot carry, the pause is refused and names it; fluid status JOB shows it within the first minutes.

Keep the work directory under your working directory: a work directory somewhere else on the first machine is not on the next one.

Data loader workers

A PyTorch DataLoader with num_workers above zero moves: it goes on at the batch it was at, in the same order, with new worker processes where the job lands.

  • Early in an epoch, the numbers after a move are the unmoved run's. Each worker draws its crops, flips and other random transforms from a random stream of its own. A loader that moves within the first 64 batches of its epoch starts its new workers at the epoch's first batch and lets them load those batches again, without handing them to your loop. Each worker's stream is then where the first machine's was, and every batch after the move is the unmoved run's.
  • The price is on the restore, not on the save. Up to 64 batches are loaded twice where the job lands, with no training in between, before the job goes on. Saving the job takes no longer for it.
  • Further into an epoch, random transforms in the workers are not replayed. The new workers start their streams again. The batches after a move hold the same samples as an unmoved run's, in the same order, augmented differently for the rest of that epoch. Measured on PyTorch's ImageNet example with two workers: five unmoved runs printed the same losses to the last digit, and a run moved that way printed losses that differ from the second digit on after the move. The training is as valid as any run with another seed. It is not the unmoved run's numbers.
  • Workers kept between epochs (persistent_workers=True) are replayed in the loader's first epoch only. From the second epoch on their streams hold every epoch before, which could only be made again by loading all of it. Such a loader goes on by position, as above, wherever it is moved: early in an epoch and between two epochs too.
  • A loader told in_order=False does not pause inside a pass. It hands batches out in the order its workers finish them, so Fluid cannot tell which ones your program has received. Once your program has the first batch of a pass, a pause waits for that pass to end, wherever you keep the iterator, and the job's events say so. An iterator you read with next() stays in its pass until it raises StopIteration or you drop it. Leave in_order at its default to pause inside an epoch.
  • The move tells you. When a loader's workers start their random draws anew, the move's event names the loader among what was not carried. A move is never refused for it and a job never fails for it.
  • With num_workers=0 the transforms run in your program, whose random state moves with it: the numbers after a move are the unmoved run's, anywhere in the epoch.
  • PORTAL_LOADER_REPLAY=N sets another count. Set it in the job's environment (--env PORTAL_LOADER_REPLAY=200) to cover moves further into an epoch at the price of a longer restore, or to 0 to load nothing twice.
  • Fluid tells you when your program first starts a loader with workers.
  • A loader over torch datapipes (an IterDataPipe chain, as torchtext's datasets are) moves in the middle of an epoch when it reads in your program (num_workers=0). Where the job lands, the batches it had already handed out are read again without being given to your loop, so that restore takes as long as reading them did.
  • A datapipe chain with an on-disk cache needs the cache in the working directory. torchdata's on_disk_cache (which torchtext's datasets use, under ~/.torchtext/cache by default) reads its files where they are and fetches them again where they are not, so on the next machine the chain would read differently. Pass the dataset a relative root= that the working directory carries (Multi30k(root="data", ...), not .cache, which is left behind by default) and the loop moves inside an epoch; with the cache anywhere else, a pause waits until the current pass over the loader ends.

WebDataset

A WebDataset reads samples from tar shards through a chain of generators, which hold the open shard and the shuffle's buffer. Where your job can pause depends on how it reads the dataset.

  • Through a data loader with workers. With wds.WebLoader(dataset, num_workers=2) or torch's DataLoader, the job pauses at any step inside a pass over the shards and moves. Where it lands, new workers read the pass's batches again up to that step, and your loop gets the next one. Verified: a moved run sees the batches of an unmoved one and ends with the same weights, to the bit. The second reading costs time in proportion to how far into the pass the job was.
  • Read by the loop itself (for sample in dataset:), with shards that are files under your working directory: the job pauses at any step inside a pass and moves. The generators travel where they stand, with the shuffle's buffer, and the open shard is opened again at the member it stood at. A dataset that repeats (.repeat()) moves the same way.
  • Through a loader with num_workers=0, or over shards read from a URL or a pipe: a pause waits until the pass over the shards ends, and the job moves there. The same holds when the loader's dataset wraps the WebDataset (ChainDataset, or a dataset of your own that keeps it in an attribute). Fluid says so at each step it passes over. A dataset that repeats without end then has no place to pause: read it through a loader with workers.
  • Shuffles. A shuffle seeded by your program is drawn the same again where the job lands. One seeded from the clock is not the same in two unmoved runs either: after a move the rest of the pass comes in another order.
  • Workers kept between passes (persistent_workers=True). The shuffle then lives in the kept workers and has moved on through every pass before. New workers start it from its seed, so from the second pass on the samples after a move come in another order than an unmoved run's. Leave persistent_workers off to get the unmoved run's samples.
  • Where the shards are. Shards under your working directory travel with the job. Shards read from a URL or through a pipe (pipe:aws s3 cp ...) are read again from there on the new machine, which must reach them.

Not verified: wds.ShardWriter open across a move, wids indexed datasets, and decoding on a GPU.

Reinforcement learning

The agent, its optimizer and a replay buffer move like any other state. An Atari environment moves too. Most other environments do not.

Atari (ALE)

  • An Atari environment moves with its console. Fluid reads the emulator's own state where the job pauses (the machine, the game's memory, the score and the lives, and the random stream that sticky actions draw from) and puts it back where the job lands. The next step and the next reset return what they would have returned on the first machine, to the bit. Measured with ale-py 0.9.0 under Gymnasium 0.29.1 and with ale-py 0.12.1 under Gymnasium 1.4.0.
  • Wrappers keep their state as before, and now describe the game that is still being played: stacked frames, episode statistics, lives. A SyncVectorEnv moves with every environment in it.
  • The picture is drawn again when a frame is played. The screen is drawn while a frame is played, and no state holds it. After a move, render() shows the new console's first picture until the next step of a game under way, or the next reset. The observations those return are not affected. A step on a game that is already over plays no frame, so it returns that picture too: reset a finished game before you step it, as Gymnasium asks.
  • A setting changed on the console after it was made stops the move. If your program calls setFloat, setInt or setBool on env.unwrapped.ale after gymnasium.make, the move is refused at its check and the job stays where it runs. Give the setting to gymnasium.make instead.
  • Keep the environment, not its console. A variable that holds env.unwrapped.ale itself across a step cannot be carried: ask the environment for it when you need it.
  • This covers ale_py's own AtariEnv. A class you make from it, ale-py before 0.9, and environments in worker processes (AsyncVectorEnv, AtariVectorEnv) are not covered.

Other environments

  • An environment starts over where the job lands. Gymnasium pickles most environments as the arguments they were made with (EzPickle): MuJoCo, Box2D and others. The simulator's own state is not in a checkpoint. After a move or a resume the simulation is at its first step again, while your program is in the middle of an episode.
  • Training goes on. The episode under way is cut short without a terminated or truncated signal, and the numbers after it are another run's, not an unmoved run's.
  • Wrappers written in Python keep their state: stacked frames, episode statistics, counters. Right after a move they describe the episode that was left behind.
  • Fluid tells you when your program first makes such an environment.
  • To keep runs comparable, checkpoint at an episode's end with code of your own, or accept one cut episode per move.

Launchers

A launcher reads the command line and calls your function: your training loop runs with the launcher's own functions below it for as long as it runs. Fluid pauses inside your loop all the same and carries what the launcher keeps for the run.

click and typer

  • A program a click command starts moves: a single command, and a command of a group. The current context (click.get_current_context(), @click.pass_context, @click.pass_obj) is the same where the job lands, and what you registered with ctx.call_on_close() runs once, when your command returns.
  • typer is the same: typer.run(main) and a Typer app with a callback and commands.
  • An open file the command line gave your program (click.File, ctx.with_resource(open(...))) holds a pause, as any open file does. Take a path and open the file where you use it.
  • A context class of your own (context_class) that overrides __enter__ or __exit__ holds every pause under it: Fluid does not know what your class does when it is entered, and would do it twice. Put that work in the command, or in ctx.call_on_close().

jsonargparse

  • A program auto_cli() (CLI()) starts from a function, or from a class and one of its methods, moves with the settings the command line gave it. A LightningCLI is Lightning's: see PyTorch Lightning.

Hydra

  • A program under @hydra.main moves inside its function. The configuration you read at every step is the same object where the job lands. What Hydra says of the run goes on too: HydraConfig.get(), get_original_cwd(), to_absolute_path(), the choices and the overrides.
  • The run's output directory and its log file travel with the job's working directory. Hydra's default (outputs/<date>/<time>) is under it. With hydra.job.chdir=true your program is in the output directory where it lands, and Hydra goes back to the directory the job was started in when your function returns.
  • An output directory outside the job's working directory (hydra.run.dir=/somewhere/else) is not carried: what your program wrote there stays on the first machine.
  • A sweep (--multirun) cannot pause or move. Hydra composes each job's configuration when its turn comes, from the configuration directory by the path it had on the first machine. Fluid refuses the pause and says so. Run each combination as a Fluid job of its own, without --multirun.
  • Configuration composed again after a move (compose() after a bare initialize()) is not verified: it reads the configuration directory by the first machine's path.

TorchScript

A module made with torch.jit.script, torch.jit.trace or torch.jit.freeze moves with the job, whether it is being trained or only run.

  • Its parameters stay the ones everything else holds. Your optimizer, the plain module you scripted it from and the scripted module share the same tensors where the job lands, with the optimizer's momentum or moments. Fluid checks this at every restore and refuses the restore if it does not hold.
  • The module's own numbers travel (a counter it keeps, batch norm's count), and its training mode. A module you hold beside the model it belongs to (head = model.head) is still that model's own module.
  • Results after a move may differ from an unmoved run's in the last digits. TorchScript optimizes a module from its first calls, and that state cannot be carried: where the job lands the module's first calls run its code as written. A training run then goes on a last digit apart, as it would with another seed for rounding. Measured over 120 steps with one move: the final loss within one part in ten million; under Adam single weights can end visibly apart. The move's event says this for every scripted module the job holds.
  • A module TorchScript cannot write and read back holds the pause, and the refusal quotes TorchScript's error: one that calls a function marked @torch.jit.ignore (mark it @torch.jit.unused if the scripted code never needs it), and PyTorch Geometric's GCNConv when scripted.
  • A frozen module whose weights are on a GPU holds the pause. Its weights are constants of its code, which TorchScript would read back on that same device. Freeze the module on the CPU and move it to the GPU, or keep the scripted module and freeze it where it is used.
  • A tensor a module holds as a plain attribute, neither a parameter nor a buffer, comes back as the module's own copy. Register it as a buffer if something else of your program holds it too.
  • A function made with torch.jit.script (not a module) is not carried: a variable that holds one holds the pause.

A loop inside a with block

A job pauses inside a with block when Fluid can enter the block again where the job lands and your program finds there what it had.

  • Blocks a job moves in: torch.no_grad(), torch.enable_grad(), torch.set_grad_enabled(), torch.inference_mode(), torch.autocast(...), with torch.device("cuda") (a device named without a GPU number), a tqdm bar, mlflow.start_run(), numpy.errstate, contextlib.nullcontext and contextlib.suppress.
  • Accelerate's LocalSGD around a training loop moves in a job of one process, with its count of steps. Across several processes it is not carried, and a pause waits for the block to end.
  • A contextlib.ExitStack moves when it holds nothing or only blocks from the list above (stack.enter_context(torch.autocast(...))). One that holds a callback of yours (stack.callback(...)), an open file or another block Fluid cannot enter again holds the pause, and the refusal names what it holds. So does a stack that holds a block of one kind while a block of the same kind is open inside it, around it or held by another stack, such as stack.enter_context(torch.enable_grad()) under an inner with torch.no_grad():. Fluid cannot tell which of the two your program entered first, so the pause waits for the inner block to end.
  • A block around one step (with accelerator.accumulate(model):, autocast around one forward) does not hold the loop: the job pauses between two steps.
  • A decorated function is the same. A job pauses inside a function under @torch.no_grad(), @torch.enable_grad(), @torch.inference_mode(), @torch.set_grad_enabled(...) or @torch.autocast(...), on a function, a method or a generator function, and the mode is the decorator's where it lands. A function called through functools.lru_cache or a wrapt decorator is called from compiled code: a pause waits until it returns.
  • One autocast block around a whole training loop is not the same after a move. PyTorch keeps cast copies of your weights for the length of an autocast block, and they are not carried: after a move the block reads the weights as they are now. Enter autocast around each forward, which is also what PyTorch recommends.
  • A profiler's block is not carried (torch.profiler.profile, torch.autograd.profiler.profile). What it collected before the move would be lost, so a pause waits until the block ends, and says so. Profile a few steps in a block of their own and train outside it.
  • For any other block, a pause waits until the block ends. If your whole training runs inside one, move the loop out of it, or keep what the block gives you in a value your program holds.

Not verified yet

Detectron2, ClearML, NVIDIA DALI, FFCV and TensorRT have no test with Fluid yet. Each one does something a checkpoint has to account for: a training loop inside the library, threads or a process of its own, or state on the GPU that belongs to one GPU model.

  • Fluid runs the job and tells you when your program first uses one of them.
  • A move may wait, be refused or go through. For a library that runs its own training loop, a pause may wait until the call returns. For one that holds state Fluid cannot carry, the checkpoint check reports it within the first minutes. fluid status JOB shows it.
  • Try it before you rely on it. Run a short job and move it once with fluid move JOB. Compare what it ends with to a run that did not move.
  • On spot, run these on an on-demand machine until you have seen your job move, or write results to storage of your own as you go.

Trackers are reported when a run starts, not when the library is imported: transformers imports Comet wherever it is installed, and that alone says nothing about your job.

On an NVIDIA GPU

Each library on this page that computes on a GPU was moved there by Fluid's tests: a job was paused while its model, optimizer state and batches were on the GPU, continued in a fresh process, and compared with two runs that were never moved.

LibraryA moved run compared with an unmoved one
Hugging Face Trainer, TRL, PEFT, a gradient scaler with float16The same, to the bit
bitsandbytes, 4-bit and 8-bitThe same, to the bit
PyTorch Lightning, Lightning FabricThe same, to the bit
Keras 3 on the PyTorch backendThe same, to the bit
TensorFlow loops, with a tf.data pipelineThe same, to the bit
CuPyThe same, to the bit
timm, PyTorch Geometric, Diffusers, a loop over Accelerate (float16 too)The same, to the bit, with torch.use_deterministic_algorithms(True)
MONAI, with set_determinism()The same, to the bit
sentence-transformersThe same, to the bit
ONNX Runtime on its CUDA providerThe same, to the bit
CatBoost around a fitThe same, to the bit
JAX, Keras 3 on the JAX backendThe same to the bit with XLA_FLAGS=--xla_gpu_deterministic_ops=true. Without it, within the difference between two unmoved runs (up to 0.3%)
Keras 3 on the TensorFlow backendThe same to the bit with tf.config.experimental.enable_op_determinism(). Without it, within the difference between two unmoved runs (up to 0.4%)
XGBoost with device="cuda"Equal to seven digits. Two unmoved runs are the same to the bit
LightGBM with device_type="gpu", RAPIDS cuDF and cuMLWithin the difference between two unmoved runs
Several GPUs with --ranks, each rank on a GPU of its own over NCCL: a script written for torchrun (DistributedDataParallel, synchronized batch normalization, a gradient scaler), the Hugging Face Trainer and Lightning's DDP strategyOn two GPUs and on four the same as an unmoved run, to the bit, for all three

What these runs do not show:

  • A move to another model of GPU. Both sides of each move were the same model (an L4, or T4s for several GPUs). A program's numbers can differ in their last bits between GPU models, moved or not.
  • Large models. The models were small. What a move of a large one costs is its size: see Spot and checkpoints.
  • A move through the whole service. The tests move a job between two of its hosts on one machine, with the runtime of the release, and compare the results. The job engine's part of a move is the same for every job and is tested without these libraries.

Where Fluid tells you

  • The plan. fluid run train.py --plan reads your project's requirements. Each library on this page that they name is listed with its level, and with a warning unless it moves.
  • The job's events. When your program first uses a library on this page, the job gets one event for it. fluid explain JOB lists it as a checkpoint warning.
  • The job's status. fluid status JOB, the console's run page and the MCP status tool show the libraries the job has used, with each one's level and limit.

Fluid looks at use, not at what is installed. A job that imports transformers for a tokenizer and trains in its own loop gets no Trainer warning.

JAX, TensorFlow and a few others have no single function that means "in use", so they count from the moment they are imported, by your program or by a library it uses. TensorBoard imports TensorFlow where it is installed, and TensorFlow imports JAX, so a PyTorch job that writes TensorBoard logs in such an environment lists all three. They are in the job's process, and Fluid carries them as it carries the rest.

What to do about a limit

  • A loop inside a library (waits). Keep each call short enough to fit inside your machine's notice, or run on an on-demand machine. A training loop in your own code pauses at every iteration, and so do the Hugging Face Trainer, PyTorch Lightning, Keras 3, XGBoost and Optuna's study.optimize(). For LightGBM, make the fit in several calls (see Gradient boosting).
  • A tracker. TensorBoard and MLflow move. For Weights & Biases on W&B's servers, run a short job first and move it once (fluid move JOB) to see what your project shows, or log offline and sync at the end.
  • Several processes. Let Fluid start them: run a script written for torchrun with --ranks N. Lightning's and Fabric's DDP and the Hugging Face Trainer then start none themselves. See Several GPUs.
  • A GPU library whose numbers vary from run to run. If you need the same numbers after a move as before it, turn on the library's deterministic mode where it has one (see On an NVIDIA GPU). Without it a moved run differs from an unmoved one by no more than two unmoved runs differ from each other.
  • Unverified. Run it. The checkpoint check reports within the first minutes what a checkpoint could not carry.
  • A cluster of the library's own (blocks). Ray, a Dask client and Spark. Run on an on-demand machine and save with the library's own checkpoints, or for Dask compute in the job's own process with no client (see Ray, Dask and Spark).
  • Several devices in one process (blocks). A tf.distribute strategy, keras.distribution and a JAX mesh keep state their library cannot save. Train on one device, or in PyTorch with --ranks N.

On this page