aminshabani / house_diffusion

The implementation of "HouseDiffusion: Vector Floorplan Generation via a Diffusion Model with Discrete and Continuous Denoising", https://arxiv.org/abs/2211.13287
Other
145 stars 35 forks source link

IndexError: index 0 is out of bounds for axis 0 with size 0 #20

Open adeerkhan opened 7 months ago

adeerkhan commented 7 months ago

What might be this error?

(myenv) root@eb3fe363e935:/workspace/house_diffusion/scripts# python image_train.py --dataset rplan --batch_size 32 --set_name train --target_set 6
Logging to ckpts/openai_2024_04_06_20_34_10_584347
creating model and diffusion...
Number of model parameters: 26541330
COSINE
creating data loader...
training...
loading train of target set 6
100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 77291/77291 [05:50<00:00, 220.52it/s]
  0%|                                                                                                      | 18/53061 [00:00<06:26, 137.10it/s]
Traceback (most recent call last):
  File "/workspace/house_diffusion/scripts/image_train.py", line 90, in <module>
    main()
  File "/workspace/house_diffusion/scripts/image_train.py", line 47, in main
    TrainLoop(
  File "/workspace/house_diffusion/house_diffusion/train_util.py", line 160, in run_loop
    batch, cond = next(self.data)
  File "/workspace/house_diffusion/house_diffusion/rplanhg_datasets.py", line 31, in load_rplanhg_data
    dataset = RPlanhgDataset(set_name, analog_bit, target_set)
  File "/workspace/house_diffusion/house_diffusion/rplanhg_datasets.py", line 151, in __init__
    graph_nodes, graph_edges, rooms_mks = self.build_graph(rms_type, fp_eds, eds_to_rms)
  File "/workspace/house_diffusion/house_diffusion/rplanhg_datasets.py", line 472, in build_graph
    poly = self.make_sequence(np.array([fp_eds[l][:4] for l in eds_poly]))[0]
  File "/workspace/house_diffusion/house_diffusion/rplanhg_datasets.py", line 392, in make_sequence
    v_curr = tuple(edges[0][:2])
IndexError: index 0 is out of bounds for axis 0 with size 0
LiSSww commented 6 months ago

Hello! I encountered the same problem. Have you solved this problem? 13Z2L~ NIGQVVQVOFUO4L$K @adeerkhan @aminshabani

NguyenVanThanhHust commented 6 months ago

@LiSSww @adeerkhan Did you try to filter data according to https://github.com/aminshabani/house_diffusion/issues/5 ?

adeerkhan commented 6 months ago

@NguyenVanThanhHust Yes, I'm pass that stage, I have two questions:

1- When does the training stop? There is no parameter that defines the no. of steps it will run, and up to which checkpoint number does the training go?

2- I am having this new error on the sampling stage: Command: _house_diffusion/scripts python image_sample.py --dataset rplan --batch_size 2 --set_name eval --target_set 8 --model_path ckpts/exp/model1470000.pt --num_samples 64_

Warning: batch size is bigger than the data size. Setting batch size to data size
Traceback (most recent call last):
  File "/home/adeer/Github/house_diffusion/scripts/image_sample.py", line 378, in <module>
    main()
  File "/home/adeer/Github/house_diffusion/scripts/image_sample.py", line 352, in main
    fid_score = calculate_fid_given_paths(['outputs/gt', 'outputs/pred'], 64, 'cuda', 2048)
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 259, in calculate_fid_given_paths
    m1, s1 = compute_statistics_of_path(paths[0], model, batch_size,
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 243, in compute_statistics_of_path
    m, s = calculate_activation_statistics(files, model, batch_size,
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 228, in calculate_activation_statistics
    act = get_activations(files, model, batch_size, dims, device, num_workers)
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 122, in get_activations
    dataloader = torch.utils.data.DataLoader(dataset,
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 357, in _init_
    batch_sampler = BatchSampler(sampler, batch_size, drop_last)
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/torch/utils/data/sampler.py", line 232, in _init_
    raise ValueError("batch_size should be a positive integer value, "
ValueError: batch_size should be a positive integer value, but got batch_size=0

PS: My Fork, where I've fixed the index out of bounds error: https://github.com/adeerkhan/house_diffusion

SeasonMeng commented 2 months ago

@NguyenVanThanhHust是的,我已经过了那个阶段,我有两个问题:

1- 训练何时停止?没有参数定义它将运行的步骤数,以及训练将进行到哪个检查点号?

2-我在采样阶段遇到这个新错误: 命令:_house_diffusion/scripts python image_sample.py --dataset rplan --batch_size 2 --set_name eval --target_set 8 --model_path ckpts/exp/model1470000.pt --num_samples 64_

Warning: batch size is bigger than the data size. Setting batch size to data size
Traceback (most recent call last):
  File "/home/adeer/Github/house_diffusion/scripts/image_sample.py", line 378, in <module>
    main()
  File "/home/adeer/Github/house_diffusion/scripts/image_sample.py", line 352, in main
    fid_score = calculate_fid_given_paths(['outputs/gt', 'outputs/pred'], 64, 'cuda', 2048)
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 259, in calculate_fid_given_paths
    m1, s1 = compute_statistics_of_path(paths[0], model, batch_size,
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 243, in compute_statistics_of_path
    m, s = calculate_activation_statistics(files, model, batch_size,
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 228, in calculate_activation_statistics
    act = get_activations(files, model, batch_size, dims, device, num_workers)
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/pytorch_fid/fid_score.py", line 122, in get_activations
    dataloader = torch.utils.data.DataLoader(dataset,
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 357, in _init_
    batch_sampler = BatchSampler(sampler, batch_size, drop_last)
  File "/home/adeer/Github/house_diffusion/venv/lib/python3.9/site-packages/torch/utils/data/sampler.py", line 232, in _init_
    raise ValueError("batch_size should be a positive integer value, "
ValueError: batch_size should be a positive integer value, but got batch_size=0

PS:我的 Fork,我已修复索引超出范围的错误:https://github.com/adeerkhan/house_diffusion Hi, can I ask about this project, have you run it in its entirety? So far I'm only running into an issue where when I run the code, it neither runs nor reports an error. I read in other Issue that it can be solved by upgrading python to 3.9, but after I upgraded to 3.9.19, again, no problem solved. So I would like to ask you if you have ever encountered the same problem. my email is mengshisen88@gmail.com