在这个示例中,我们首先导入了 seed_everything 函数,并设置了随机种子为 42。然后,我们定义了一个简单的 LightningModule,并初始化了模型。最后,我们使用 Trainer 来训练模型。由于设置了随机种子,无论运行多少次这段代码,实验结果都应该是相同的。
25 from lightning_fabric.utilities.seed import seed_everything # noqa: E402 26 from lightning_fabric.utilities.warnings import disable_possible_user_warnings # noqa: E402 ---> 27 from pytorch_lightning.callbacks import Callback # noqa: E402 ...
random_splitfrom torchvision.datasets import MNISTfrom torchvision import datasets, transformsimport pytorch_lightning as plfrom pytorch_lightning import Trainerfrom pytorch_lightning.core.lightning import LightningModule# transforms# prepare transforms
last_model_path, ) trainer.fit(task, train_dataloader) <--- this is where will fail breaks at the first training step: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/plugins/precision/native_amp.py#L96 complains about /mnt/xarfuse/uid-26337/a9b1f2c7-seed...
I suppose in the empty bracket can stand sth. But I dont know what can stand there and where to do it. I can't seem to find it in the docs not undertrainernor undertest setstands for what this is. If I am right and it doesn'T stand anywhere maybe add to the docs. ...