Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Encoder' object has no attribute 'rnn_type' #35

Open
forestbat opened this issue Jun 18, 2023 · 1 comment
Open

AttributeError: 'Encoder' object has no attribute 'rnn_type' #35

forestbat opened this issue Jun 18, 2023 · 1 comment
Labels
question Further information is requested

Comments

@forestbat
Copy link

❔Question

我初始化模型:

model = AutoModel('seq2seq', custom_model_params={
            "rnn_type": "lstm",
            "bi_direction": False,
            "rnn_size": 64,
            "dense_size": 64,
            "num_stacked_layers": 1,
            "scheduler_sampling": 0,  # teacher forcing
            "use_attention": False,
            "attention_sizes": 64,
            "attention_heads": 2,
            "attention_dropout": 0,
            "skip_connect_circle": False,
            "skip_connect_mean": False,
        })

但是在运行时报错:

test_seq2seq.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\ProgramData\Anaconda3\envs\my2ndconda\lib\site-packages\tfts\models\auto_model.py:35: in __init__
    self.model = Seq2seq(predict_sequence_length=predict_length, custom_model_params=custom_model_params)
C:\ProgramData\Anaconda3\envs\my2ndconda\lib\site-packages\tfts\models\seq2seq.py:44: in __init__
    self.encoder = Encoder(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tfts.models.seq2seq.Encoder object at 0x0000026FBCA68CA0>
rnn_type = 'lstm', rnn_size = 64, rnn_dropout = 0, dense_size = 64, kwargs = {}

    def __init__(self, rnn_type, rnn_size, rnn_dropout=0, dense_size=32, **kwargs):
        super(Encoder, self).__init__(**kwargs)
        if rnn_type.lower() == "gru":
            self.rnn = GRU(
                units=rnn_size, activation="tanh", return_state=True, return_sequences=True, dropout=rnn_dropout
            )
>       elif self.rnn_type.lower() == "lstm":
E       AttributeError: 'Encoder' object has no attribute 'rnn_type'

C:\ProgramData\Anaconda3\envs\my2ndconda\lib\site-packages\tfts\models\seq2seq.py:112: AttributeError

这是怎么回事?tfts版本为0.0.6.

Additional context

@forestbat forestbat added the question Further information is requested label Jun 18, 2023
@LongxingTan
Copy link
Owner

@forestbat

可以试试更新一下 到0.0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants