Fix pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [0] But your machine only has: [] – PyTorch Tutorial

By | December 7, 2021

In this tutorial, we will introduce you how to fix pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [0] But your machine only has: [].

This error looks like:

fix pytorch_lightning.utilities.exceptions.MisconfigurationException - You requested GPUs - [0]

In our computer, we only install one gpu. However, our code is:

trainer = Trainer(max_epochs=100, gpus=1)
trainer.fit(system)

The index of first gpu is 0, gups = 1, which means we will use second gpu.

In order to fix this error, we should set gpus = 0.

trainer = Trainer(max_epochs=100, gpus=0)
trainer.fit(system)