Error with small sample size data
bbb801 opened this issue · 3 comments
Dear Sir,
I have used a sample size to be 100 rows and set the parameters like this,
import pandas as pd
from tgan.model import TGANModel
data = pd.read_csv('1111112.csv')
continuous_columns = [0, 1, 2, 4]
tgan = TGANModel(
continuous_columns,
output='output',
max_epoch=10,
steps_per_epoch=10,
save_checkpoints=True,
restore_session=True,
batch_size=16,
z_dim=20,
noise=0.2,
l2norm=0.00001,
learning_rate=0.001,
num_gen_rnn=10,
num_gen_feature=10,
num_dis_layers=1,
num_dis_hidden=10,
optimizer='AdamOptimizer'
)
#help(tgan)
tgan.fit(data)
It has an error:
Traceback (most recent call last):
File "<ipython-input-140-25e5d1cea3b4>", line 25, in <module>
tgan.fit(data)
File "D:\anaco\lib\site-packages\tgan\model.py", line 690, in fit
input_queue=input_queue,
File "D:\anaco\lib\site-packages\tgan\trainer.py", line 30, in __init__
cbs = input_queue.setup(inputs_desc)
File "D:\anaco\lib\site-packages\tensorpack\utils\argtools.py", line 176, in wrapper
return func(*args, **kwargs)
File "D:\anaco\lib\site-packages\tensorpack\input_source\input_source_base.py", line 99, in setup
self._setup(input_signature)
File "D:\anaco\lib\site-packages\tensorpack\input_source\input_source.py", line 214, in _setup
self._input_placehdrs = [build_or_reuse_placeholder(v) for v in inputs]
File "D:\anaco\lib\site-packages\tensorpack\input_source\input_source.py", line 214, in <listcomp>
self._input_placehdrs = [build_or_reuse_placeholder(v) for v in inputs]
File "D:\anaco\lib\site-packages\tensorpack\graph_builder\model_desc.py", line 35, in build_or_reuse_placeholder
"Tensor {} exists but is not compatible with the signature!".format(tensor)
AssertionError: Tensor Tensor("input00value:0", shape=(200, 1), dtype=float32) exists but is not compatible with the signature!
Could you give some suggestions? Thanks.
Hi @bbb801 and thanks for reporting this issue.
I think the root of your problem is that, either being aware or not, you are reusing a fitted model, but instantiating it with different parameters, which causes the crash.
I think that instantiating TganModel
using either restore_session=False
( which will ignore the previous model and overwrite it), another value for the output
keyword argument, or simply pass to the model the same parameters that were used to create the first instance should avoid this error.
If the problem persist, please let me know which solution you choose, and the outputs that it gave you.
@bbb801 would you mind reporting whether the comment from @ManuelAlvarezC above did solve the issue?
If so, let us know, so we can close the issue.