Comments (9)
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.
from textgan-pytorch.
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
.
from textgan-pytorch.
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'
from textgan-pytorch.
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
from textgan-pytorch.
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.
from textgan-pytorch.
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'`
from textgan-pytorch.
has some problem.
How did you solve your problem?
from textgan-pytorch.
has some problem.
How did you solve your problem?
@Cyy1216
from textgan-pytorch.
I am also getting the same error.
AttributeError: 'CatGANInstructor' object has no attribute 'train_samples_list'
How to resolve it ?
from textgan-pytorch.
Related Issues (20)
- Sentigan generates repetitive samples HOT 1
- Sentigan generates repetitive samples HOT 2
- Can you tell me the GPU model and running time when running CatGaN?
- How to generate samples from the trained SeqGan Model?
- AttributeError: 'MaliGANInstructor' object has no attribute 'train_data' HOT 3
- Some questions about the evaluation metrics
- Senti-GAN loss function -ve sign
- Execution in CPU-only Mode HOT 3
- Question about the onehot encoding
- Description data
- Runtime Error when running LeakGAN HOT 1
- How does seqgan train on real data? HOT 2
- SentiGAN reproducible results?
- question about seqgan rollout code
- Cite as and citations for datasets
- catGAN real dataset
- Training catGAN with a custom dataset: AttributeError: 'CatGANInstructor' object has no attribute 'train_samples_list'
- Question about the executable parameter of subprocess.call
- Gradient problem
- save
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textgan-pytorch.