Error from PyTorch Lightning + Google Colab + TPU

I built a translation model using Transformer and PyTorch Lightning. I am running it in Google Colab with TPU. However, I couldn’t get it to work due to the following error,

ModuleNotFoundError: ContextualVersionConflict: (google-api-python-client 2.70.0 (/usr/local/lib/python3.8/dist-packages), Requirement.parse(‘google-api-python-client==1.8.0’), {‘cloud-tpu-client’}). HINT: Try running pip install -U 'torch_xla'

I can successfully import torch_xla.

The error happens when I try to create the Trainer

runner = Trainer(logger=tb_logger,
callbacks=[
LearningRateMonitor(),
ModelCheckpoint(save_top_k=2,
dirpath=os.path.join(tb_logger.log_dir, “checkpoints”),
monitor=“val_loss”,
save_last=True),
],
# strategy=DDPStrategy(find_unused_parameters=False),
strategy=None,
**config[“trainer_params”],
)

Here is my google colab notebook: Google Colab

At the beginning of the notebook, I was trying to install all the required packages.

1 Like