awei669 / VQ-Font

[ICCV 2023] Few shot font generation via transferring similarity guided global and quantization local styles
https://arxiv.org/abs/2309.00827
127 stars 6 forks source link

TypeError: stack(): argument 'tensors' (position 1) must be tuple of Tensors, not NoneType #5

Open zhenzi0322 opened 10 months ago

zhenzi0322 commented 10 months ago

训练时出现如下问题:

Traceback (most recent call last):
  File "train.py", line 220, in <module>
    main()
  File "train.py", line 216, in main
    train(args, cfg)
  File "train.py", line 209, in train
    trainer.train(trn_loader, st_step, cfg["iter"], component_objects, chars_sim_dict)
  File "/app/trainer/combined_trainer.py", line 78, in train
    out_1, style_components_1 = self.gen.read_decode(trg_style_ids, trg_sample_index,
  File "/app/model/generator.py", line 69, in read_decode
    reference_feats = self.memory.read_chars(target_style_ids, trg_sample_index, reduction=reduction)
  File "/app/model/memory.py", line 90, in read_chars
    sc_feat = read_char(style_id, sample_index, reduction)
  File "/app/model/memory.py", line 49, in read_char
    comp_feat = self.read_point(style_id, sample_index, reduction)
  File "/app/model/memory.py", line 41, in read_point
    return torch.stack(sc_feats)
TypeError: stack(): argument 'tensors' (position 1) must be tuple of Tensors, not NoneType
awei669 commented 10 months ago

你好,是否可以提供更多的报错信息?

看起来是这一步出问题了: reference_feats = self.memory.read_chars(target_style_ids, trg_sample_index, reduction=reduction)

可以检查一下这一步输出的特征纬度是否正确: self.gen.encode_write_comb(in_style_ids, style_sample_index, in_imgs[0]) # [B*3,256,16,16]

zhenzi0322 commented 10 months ago

trainer/combined_trainer.py:

image

上图就是我本地中的输出

awei669 commented 9 months ago

看起来是某一次sample的reference个数不足k(num shot)个,但不足k个的batch应该会被丢掉才对,建议你仔细观察得到风格特征过程中tensor的维度变化。

zhenzi0322 commented 9 months ago

一直没找到原因,我这边就是卡在这一步,训练不了

Gabrielprogramist commented 3 months ago

Were you able to solve the problem? If so, how?

一直没找到原因,我这边就是卡在这一步,训练不了

zhenzi0322 commented 3 months ago

Were you able to solve the problem? If so, how?

一直没找到原因,我这边就是卡在这一步,训练不了

I was the one who ran successfully before, but I'm not quite sure where the modifications were made