CompVis / latent-diffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
11.7k stars 1.52k forks source link

Training latent-diffusion on my dataset #301

Closed JoonilHwang closed 1 year ago

JoonilHwang commented 1 year ago

Hi I have a question that I want to train the diffusion model with CT images.

I have changed the lsun_bedrooms-ldm-vq-4.yaml in config to my data sets than the code occurs some error that

FileNotFoundError: [Errno 2] No such file or directory: 'models/first_stage_models/kl-f8/model.ckpt'

Is there some model file for it? how can I solve this problems..

JoonilHwang commented 1 year ago

you could download the trained model at github!

황준일 Hwang, Joon ilNuclear & Quantum Engineering, Medical Imaging & Radiotherapy Laboratory / Ph.D candidate34141 대전광역시 유성구 대학로 291 한국과학기술원(KAIST)Mobile 01071799466 Email  @. @.

-----Original Message-----From: "qing_kong" @.>To: "CompVis/latent-diffusion" @.>;Cc: "JoonilHwang" @.>; "State change" @.>;Sent: 2023-10-02 (월) 12:16:57 (UTC+09:00)Subject: Re: [CompVis/latent-diffusion] Training latent-diffusion on my dataset (Issue #301) hello, how are you solve this problems? can you ask me ? thanks! —Reply to this email directly, view it on GitHub https://github.com/CompVis/latent-diffusion/issues/301#issuecomment-1742348095, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TI73FEUY42USJ3FRSZ7HDX5IW2NANCNFSM6AAAAAA2J3RKDU.You are receiving this because you modified the open/close state.Message ID: @.***>

yudongjian commented 1 year ago

you could download the trained model at github! 황준일 Hwang, Joon ilNuclear & Quantum Engineering, Medical Imaging & Radiotherapy Laboratory / Ph.D candidate34141 대전광역시 유성구 대학로 291 한국과학기술원(KAIST)Mobile 01071799466 Email  @. @. -----Original Message-----From: "qing_kong" @.>To: "CompVis/latent-diffusion" @.>;Cc: "JoonilHwang" @.>; "State change" @.>;Sent: 2023-10-02 (월) 12:16:57 (UTC+09:00)Subject: Re: [CompVis/latent-diffusion] Training latent-diffusion on my dataset (Issue #301) hello, how are you solve this problems? can you ask me ? thanks! —Reply to this email directly, view it on GitHub #301 (comment), or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TI73FEUY42USJ3FRSZ7HDX5IW2NANCNFSM6AAAAAA2J3RKDU.You are receiving this because you modified the open/close state.Message ID: @.***>

Hello, I already download the trained model. It's is very great. But I have own datasets, it similar imageNet. I don't kown how train it. Because it have conditional class, I don't quite understand his example of imageNet. Hope get your help. Thanks!
Wishing you a fun life!

JoonilHwang commented 1 year ago

First of all you should download the imageNet files and see how the datasets consist.

Then you could change the imageNet.py in the github code!

I hope this will help

황준일 Hwang, Joon ilNuclear & Quantum Engineering, Medical Imaging & Radiotherapy Laboratory / Ph.D candidate34141 대전광역시 유성구 대학로 291 한국과학기술원(KAIST)Mobile 01071799466 Email  @. @.

-----Original Message-----From: "qing_kong" @.>To: "CompVis/latent-diffusion" @.>;Cc: "JoonilHwang" @.>; "State change" @.>;Sent: 2023-10-04 (수) 11:40:30 (UTC+09:00)Subject: Re: [CompVis/latent-diffusion] Training latent-diffusion on my dataset (Issue #301) you could download the trained model at github! 황준일 Hwang, Joon ilNuclear & Quantum Engineering, Medical Imaging & Radiotherapy Laboratory / Ph.D candidate34141 대전광역시 유성구 대학로 291 한국과학기술원(KAIST)Mobile 01071799466 Email  @. @.… #-----Original Message-----From: "qing_kong" @.>To: "CompVis/latent-diffusion" @.>;Cc: "JoonilHwang" @.>; "State change" @.>;Sent: 2023-10-02 (월) 12:16:57 (UTC+09:00)Subject: Re: [CompVis/latent-diffusion] Training latent-diffusion on my dataset (Issue #301 https://github.com/CompVis/latent-diffusion/issues/301) hello, how are you solve this problems? can you ask me ? thanks! —Reply to this email directly, view it on GitHub #301 (comment) https://github.com/CompVis/latent-diffusion/issues/301#issuecomment-1742348095, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TI73FEUY42USJ3FRSZ7HDX5IW2NANCNFSM6AAAAAA2J3RKDU.You https://github.com/notifications/unsubscribe-auth/A3TI73FEUY42USJ3FRSZ7HDX5IW2NANCNFSM6AAAAAA2J3RKDU.You are receiving this because you modified the open/close state.Message ID: @.> Hello, I already download the trained model. It's is very great. But I have own datasets, it similar imageNet. I don't kown how train it. Because it have conditional class, I don't quite understand his example of imageNet. Hope get your help. Thanks!Wishing you a fun life! —Reply to this email directly, view it on GitHub https://github.com/CompVis/latent-diffusion/issues/301#issuecomment-1746041409, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TI73AU2BAWSKYZ5U4PBWTX5TEBXAVCNFSM6AAAAAA2J3RKDWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWGA2DCNBQHE.You are receiving this because you modified the open/close state.Message ID: @.>

yudongjian commented 1 year ago

First of all you should download the imageNet files and see how the datasets consist. Then you could change the imageNet.py in the github code! I hope this will help 황준일 Hwang, Joon ilNuclear & Quantum Engineering, Medical Imaging & Radiotherapy Laboratory / Ph.D candidate34141 대전광역시 유성구 대학로 291 한국과학기술원(KAIST)Mobile 01071799466 Email  @. @. -----Original Message-----From: "qing_kong" @.>To: "CompVis/latent-diffusion" @.>;Cc: "JoonilHwang" @.>; "State change" @.>;Sent: 2023-10-04 (수) 11:40:30 (UTC+09:00)Subject: Re: [CompVis/latent-diffusion] Training latent-diffusion on my dataset (Issue #301) you could download the trained model at github! 황준일 Hwang, Joon ilNuclear & Quantum Engineering, Medical Imaging & Radiotherapy Laboratory / Ph.D candidate34141 대전광역시 유성구 대학로 291 한국과학기술원(KAIST)Mobile 01071799466 Email  @. @.… #-----Original Message-----From: "qing_kong" @.>To: "CompVis/latent-diffusion" @.>;Cc: "JoonilHwang" @.>; "State change" @.>;Sent: 2023-10-02 (월) 12:16:57 (UTC+09:00)Subject: Re: [CompVis/latent-diffusion] Training latent-diffusion on my dataset (Issue #301 #301) hello, how are you solve this problems? can you ask me ? thanks! —Reply to this email directly, view it on GitHub #301 (comment) #301 (comment), or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TI73FEUY42USJ3FRSZ7HDX5IW2NANCNFSM6AAAAAA2J3RKDU.You https://github.com/notifications/unsubscribe-auth/A3TI73FEUY42USJ3FRSZ7HDX5IW2NANCNFSM6AAAAAA2J3RKDU.You are receiving this because you modified the open/close state.Message ID: @.> Hello, I already download the trained model. It's is very great. But I have own datasets, it similar imageNet. I don't kown how train it. Because it have conditional class, I don't quite understand his example of imageNet. Hope get your help. Thanks!Wishing you a fun life! —Reply to this email directly, view it on GitHub #301 (comment), or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TI73AU2BAWSKYZ5U4PBWTX5TEBXAVCNFSM6AAAAAA2J3RKDWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWGA2DCNBQHE.You are receiving this because you modified the open/close state.Message ID: @.>

Hello, I train a txt2img model. I used download Kl-f8 autoencoder model. So I need trian own Latent Diffusion. But my yaml config is error, I no idea modify it. Hope get your help. Thanks! Wishing you a fun life!

I run command: CUDA_VISIBLE_DEVICES=1 python main.py --base configs/latent-diffusion/f2.yaml -t --gpus 0, yaml config eg:

model: base_learning_rate: 5.0e-05 target: ldm.models.diffusion.ddpm.LatentDiffusion params: linear_start: 0.00085 linear_end: 0.012 num_timesteps_cond: 1 log_every_t: 200 timesteps: 1000 first_stage_key: image cond_stage_key: caption image_size: 32 channels: 4 cond_stage_trainable: true conditioning_key: crossattn monitor: val/loss_simple_ema scale_factor: 0.18215 use_ema: False

unet_config:
  target: ldm.modules.diffusionmodules.openaimodel.UNetModel
  params:
    image_size: 32
    in_channels: 4
    out_channels: 4
    model_channels: 320
    attention_resolutions:
    - 4
    - 2
    - 1
    num_res_blocks: 2
    channel_mult:
    - 1
    - 2
    - 4
    - 4
    num_heads: 8
    use_spatial_transformer: true
    transformer_depth: 1
    context_dim: 1280
    use_checkpoint: true
    legacy: False

first_stage_config:
  target: ldm.models.autoencoder.AutoencoderKL
  params:
    embed_dim: 4
    monitor: val/rec_loss
    ckpt_path: models/first_stage_models/kl-f8/model.ckpt
    ddconfig:
      double_z: true
      z_channels: 4
      resolution: 256
      in_channels: 3
      out_ch: 3
      ch: 128
      ch_mult:
      - 1
      - 2
      - 4
      - 4
      num_res_blocks: 2
      attn_resolutions: []
      dropout: 0.0
    lossconfig:
      target: torch.nn.Identity

cond_stage_config:
  target: ldm.modules.encoders.modules.BERTEmbedder
  params:
    n_embed: 1280
    n_layer: 32

data: target: main.DataModuleFromConfig params: batch_size: 4 num_workers: 4 wrap: false train: target: ldm.data.food.FoodTrain params: degradation: pil_nearest size: 256 validation: target: ldm.data.food.FoodVal params: degradation: pil_nearest size: 256

lightning: callbacks: image_logger: target: main.ImageLogger params: batch_frequency: 70 max_images: 3 increase_log_steps: False

trainer: benchmark: True