You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to train HWR on RIMES dataset by this command python train.py -c configs/cf_RIMESLines_hwr_cnnOnly_batchnorm_aug.json
But the error happens.
Begin training
Traceback (most recent call last):
File "train.py", line 132, in <module>
main(config, args.resume)
File "train.py", line 78, in main
trainer.train()
File "handwriting_line_generation/base/base_trainer.py", line 219, in train
result = self._train_iteration(self.iteration)
File "handwriting_line_generation/trainer/hw_with_style_trainer.py", line 378, in _train_iteration
pred, recon, losses = self.run(instance)
File "handwriting_line_generation/trainer/hw_with_style_trainer.py", line 736, in run
pred = self.model.hwr(image, style)
File "lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "handwriting_line_generation/model/cnn_only_hwr.py", line 132, in forward
conv = self.cnn(input)
File "lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "lib/python3.8/site-packages/torch/nn/modules/conv.py", line 423, in forward
return self._conv_forward(input, self.weight)
File "lib/python3.8/site-packages/torch/nn/modules/conv.py", line 419, in _conv_forward
return F.conv2d(input, weight, self.bias, self.stride,
RuntimeError: Input type (torch.cuda.LongTensor) and weight type (torch.cuda.FloatTensor) should be the same
Then I add input = input.type(torch.cuda.FloatTensor) to this function in cnn_only_hwr.py
def forward(self, input, style=None):
if self.pad is not None:
input=self.pad(input)
# conv features
input = input.type(torch.cuda.FloatTensor)
conv = self.cnn(input)
b, c, h, w = conv.size()
# assert h == 1, "the height of conv must be 1"
conv = conv.view(b, -1, w)
conv = self.cnn1d(conv)
output = conv.permute(2, 0, 1) # [w, b, c]
return output
Then this error happens:
Begin training
{'recogLoss': nan}
Traceback (most recent call last):
File "train.py", line 132, in <module>
main(config, args.resume)
File "train.py", line 78, in main
trainer.train()
File "/home/ocr/truchlp/handwriting_line_generation/base/base_trainer.py", line 219, in train
result = self._train_iteration(self.iteration)
File "/home/ocr/truchlp/handwriting_line_generation/trainer/hw_with_style_trainer.py", line 399, in _train_iteration
assert(loss==0 or (not torch.isnan(loss) and not torch.isinf(loss)))
AssertionError
I am also trying to train GAN on RIMES dataset by this command python train.py -c configs/cf_RIMESLinesslant_noMask_charSpecSingleAppend_GANMedMT_autoAEMoPrcp2tightNewCTCUseGen_balB_hCF0.75_sMG.json
But it says:
Set valid_data_loader to None
Traceback (most recent call last):
File "train.py", line 132, in <module>
main(config, args.resume)
File "train.py", line 62, in main
trainer = trainerClass(model, loss, metrics,
File "handwriting_line_generation/trainer/hw_with_style_trainer.py", line 115, in __init__
self.text_data = TextData(config['trainer']['text_data'],config['data_loader']['char_file'],text_data_batch_size,max_len=text_data_max_len,words=text_words,characterBalance=characterBalance) if 'text_data' in config['trainer'] else None
File "handwriting_line_generation/datasets/text_data.py", line 15, in __init__
with open(textfile) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'data/french_news.txt'
Thank you for helping me.
The text was updated successfully, but these errors were encountered:
I made a fix with I think will help with the first error.
The french_news.txt is derived from this database: https://webhose.io/free-datasets/french-news-articles/
I've added the python script I used to compile it's jsons into the single txt file: data/compile_french_new.py. First cre
ate a file listing all the jsons (ls > jsons.txt) then run the script.
However, any French text corpus should do, it isn't that important as it just is providing text samples that aren't in the RIMES dataset.
Thank you for your great work.
python train.py -c configs/cf_RIMESLines_hwr_cnnOnly_batchnorm_aug.json
But the error happens.
Then I add
input = input.type(torch.cuda.FloatTensor)
to this function incnn_only_hwr.py
Then this error happens:
python train.py -c configs/cf_RIMESLinesslant_noMask_charSpecSingleAppend_GANMedMT_autoAEMoPrcp2tightNewCTCUseGen_balB_hCF0.75_sMG.json
But it says:
Thank you for helping me.
The text was updated successfully, but these errors were encountered: