VQ-Font icon indicating copy to clipboard operation
VQ-Font copied to clipboard

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

Open zhenzi0322 opened this issue 1 year ago • 6 comments

训练时出现如下问题:

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

zhenzi0322 avatar Nov 09 '23 08:11 zhenzi0322

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

看起来是这一步出问题了: 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]

awei669 avatar Nov 10 '23 05:11 awei669

trainer/combined_trainer.py:

image

上图就是我本地中的输出

zhenzi0322 avatar Nov 10 '23 06:11 zhenzi0322

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

awei669 avatar Nov 17 '23 04:11 awei669

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

zhenzi0322 avatar Nov 17 '23 08:11 zhenzi0322

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

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

Gabrielprogramist avatar May 28 '24 19:05 Gabrielprogramist

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

zhenzi0322 avatar May 29 '24 08:05 zhenzi0322