Open sydwings opened 4 years ago
Do you put the comment.txt
file into the dataset
directory? The self.train_data
needs to load the dataset file you specified in the config.py
file (parameter dataset
), but it seems there is no file named dataset/comment.txt
.
I have received same error, when I changed the dataset. Even I have placed dataset file in dataset folder.
raceback (most recent call last):
File "main.py", line 167, in <module>
inst = instruction_dict[cfg.run_model](opt)
File "TextGAN-PyTorch/instructor/real_data/seqgan_instructor.py", line 23, in __init__
super(SeqGANInstructor, self).__init__(opt)
File "TextGAN-PyTorch/instructor/real_data/instructor.py", line 72, in __init__
self.ppl = PPL(self.train_data, self.test_data, n_gram=5, if_use=cfg.use_ppl)
AttributeError: 'SeqGANInstructor' object has no attribute 'train_data'
I have received same error, when I changed the dataset. Even I have placed dataset file in dataset folder.
raceback (most recent call last): File "main.py", line 167, in <module> inst = instruction_dict[cfg.run_model](opt) File "TextGAN-PyTorch/instructor/real_data/seqgan_instructor.py", line 23, in __init__ super(SeqGANInstructor, self).__init__(opt) File "TextGAN-PyTorch/instructor/real_data/instructor.py", line 72, in __init__ self.ppl = PPL(self.train_data, self.test_data, n_gram=5, if_use=cfg.use_ppl) AttributeError: 'SeqGANInstructor' object has no attribute 'train_data'
and have you sloved this problem now?I have the same problem
I have received same error, when I changed the dataset. Even I have placed dataset file in dataset folder.
raceback (most recent call last): File "main.py", line 167, in <module> inst = instruction_dict[cfg.run_model](opt) File "TextGAN-PyTorch/instructor/real_data/seqgan_instructor.py", line 23, in __init__ super(SeqGANInstructor, self).__init__(opt) File "TextGAN-PyTorch/instructor/real_data/instructor.py", line 72, in __init__ self.ppl = PPL(self.train_data, self.test_data, n_gram=5, if_use=cfg.use_ppl) AttributeError: 'SeqGANInstructor' object has no attribute 'train_data'
and have you sloved this problem now?I have the same problem
I solve it ,maybe the dataset has some problem.
I had the same issue. It turns out to be an issue with my dataset.
To overcome this, I modified the following in utils/text_process.py:
def tokens_to_tensor(tokens, dictionary):
tensor = []
for sent in tokens:
sent_ten = []
i = - 1
for i, word in enumerate(sent):
if word == cfg.padding_token:
break
sent_ten.append(int(dictionary[str(word)]))
sent_ten = sent_ten + (cfg.max_seq_len + 1 - i)*[cfg.padding_idx]
tensor.append(sent_ten[:cfg.max_seq_len])
return torch.LongTensor(tensor)
Tensor was a list with list of dynamic size. This ensures all list are of the same size, even if the list is empty.
I had the same issue. It turns out to be an issue with my dataset.
To overcome this, I modified the following in utils/text_process.py:
def tokens_to_tensor(tokens, dictionary): tensor = [] for sent in tokens: sent_ten = [] i = - 1 for i, word in enumerate(sent): if word == cfg.padding_token: break sent_ten.append(int(dictionary[str(word)])) sent_ten = sent_ten + (cfg.max_seq_len + 1 - i)*[cfg.padding_idx] tensor.append(sent_ten[:cfg.max_seq_len]) return torch.LongTensor(tensor)
Tensor was a list with list of dynamic size. This ensures all list are of the same size, even if the list is empty.
Hi, I have the same problem with catgan.py. I modified text_process.py as you suggested, but then another error appears:
File "/home/sc.uni-leipzig.de/ie870xetu/TextGAN-PyTorch/instructor/real_data/catgan_instructor.py", line 63, in __init__
self.all_train_data = CatGenDataIter(self.train_samples_list)
`AttributeError: 'CatGANInstructor' object has no attribute 'train_samples_list'`
@HernandezEduin
has some problem.
How did you solve your problem?
has some problem.
How did you solve your problem? @Cyy1216
I am also getting the same error. AttributeError: 'CatGANInstructor' object has no attribute 'train_samples_list' How to resolve it ?
Thanks for your coding.I have some small problems,could you help me? When I use my dataset,it happens. `> training arguments: