mueller-franzes / medfusion

Implementation of Medfusion - A latent diffusion model for medical image synthesis.
MIT License
160 stars 31 forks source link

train #18

Open Ystartff opened 1 year ago

Ystartff commented 1 year ago

Hello, I have a problem when using your model, do you have any good suggestions?

/home/linda/anaconda3/envs/yyf/bin/python /mnt/mewdata/yyf/medfusion-app/scripts/train_diffusion.py Lightning automatically upgraded your loaded checkpoint from v1.8.3 to v1.9.5. To apply the upgrade to your files permanently, run python -m pytorch_lightning.utilities.upgrade_checkpoint --file runs/2022_12_12_224914_eye_vaegan/last_vae.ckpt Setting up [baseline] perceptual loss: trunk [vgg], v[0.1], spatial [off] GPU available: True (cuda), used: True TPU available: False, using: 0 TPU cores IPU available: False, using: 0 IPUs HPU available: False, using: 0 HPUs Traceback (most recent call last): File "/mnt/mewdata/yyf/medfusion-app/scripts/train_diffusion.py", line 187, in trainer.fit(pipeline, datamodule=dm) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 609, in fit self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/pytorch_lightning/trainer/call.py", line 36, in _call_and_handle_interrupt return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/pytorch_lightning/strategies/launchers/multiprocessing.py", line 117, in launch start_method=self._start_method, File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 179, in start_processes process.start() File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/process.py", line 112, in start self._popen = self._Popen(self) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 32, in init super().init(process_obj) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/popen_fork.py", line 20, in init self._launch(process_obj) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 47, in _launch reduction.dump(process_obj, fp) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'BasicUp.init..'

进程已结束,退出代码1

Ystartff commented 1 year ago

Hi! I'm here again, and now I have a problem that the generated pictures are not high, can you provide some suggestions? sample_1 model = VAE( in_channels=3, out_channels=3, emb_channels=8, spatial_dims=2, hid_chs = [ 64, 128, 256, 512], kernel_sizes=[ 3, 3, 3, 3], strides = [ 1, 2, 2, 2], deep_supervision=1, use_attention= 'none', loss = torch.nn.MSELoss,

optimizer_kwargs={'lr':1e-6},

    embedding_loss_weight=1e-6
)

'runs/2022_12_02_151805_patho_vaegan/last_vae.ckpt' I found that when using other weight files, there will be redundant keys. And there is also such a problem when using VQGAN, etc.

jamalgardezi commented 1 year ago

How did you overcome this problem ? File "/mnt/mewdata/yyf/medfusion-app/scripts/train_diffusion.py", line 187, in trainer.fit(pipeline, datamodule=dm) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 609, in fit self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/pytorch_lightning/trainer/call.py", line 36, in _call_and_handle_interrupt return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/pytorch_lightning/strategies/launchers/multiprocessing.py", line 117, in launch start_method=self._start_method, File "/home/linda/anaconda3/envs/yyf/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 179, in start_processes process.start() File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/process.py", line 112, in start self._popen = self._Popen(self) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 32, in init super().init(process_obj) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/popen_fork.py", line 20, in init self._launch(process_obj) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 47, in _launch reduction.dump(process_obj, fp) File "/home/linda/anaconda3/envs/yyf/lib/python3.7/multiprocessing/reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'BasicUp.init