Hi, I am currently working on a binary image classification model and I kept running into this problem every 2 epochs. Can anyone help me with this, please?
Here is the error:
PermissionError Traceback (most recent call last)
Cell In [18], line 1
----> 1 trainer.fit(model=model, train_dataloaders=train_loader)
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pytorch_lightning\trainer\trainer.py:696, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
677 r"“”
678 Runs the full optimization routine.
679
(…)
693 datamodule: An instance of :class:~pytorch_lightning.core.datamodule.LightningDataModule
.
694 “”"
695 self.strategy.model = model
→ 696 self._call_and_handle_interrupt(
697 self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
698 )
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pytorch_lightning\trainer\trainer.py:650, in Trainer._call_and_handle_interrupt(self, trainer_fn, *args, **kwargs)
648 return self.strategy.launcher.launch(trainer_fn, *args, trainer=self, **kwargs)
649 else:
→ 650 return trainer_fn(*args, **kwargs)
651 # TODO(awaelchli): Unify both exceptions below, where KeyboardError
doesn’t re-raise
652 except KeyboardInterrupt as exception:
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pytorch_lightning\trainer\trainer.py:735, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
…
167 shutil.rmtree(p)
168 else:
→ 169 os.remove(p)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ‘c:/Users/elmow/OneDrive/Documents/Projects/Detect1/.neptune/Untitled/DET-7/checkpoints/epoch=0-step=7.ckpt’