C4_W4_Assignment

Please help, I am getting the error below when I was doing NLP specialization C4_W4 Assignment Chatbot.

My source code is shared here
def ReformerLM(vocab_size=33000, n_layers=2, mode=‘train’, attention_type=tl.SelfAttention):
“”"
Args:
vocab_size (int): size of the vocabulary
n_layers (int): number of decoder layers
mode (string): setting of the model which can be ‘train’, ‘eval’, or ‘predict’
attention_type(class): attention class to use
Returns:
model (ReformerLM): a reformer language model implemented in Trax
“”"

### START CODE HERE (REPLACE INSTANCES OF 'None' WITH YOUR CODE) ###
# initialize an instance of Trax's ReformerLM class
model = tl.Serial( 
            trax.models.reformer.ReformerLM( 
            # set vocab size
            vocab_size = vocab_size,
            # set number of layers
            n_layers = n_layers,
            # set mode
            mode = mode,
            # set attention type
            attention_type=attention_type
        )
        , tl.LogSoftmax() 
    )        
### END CODE HERE ###
return model # tl.Serial(model, tl.LogSoftmax(),)

Hi @muxin

That is a strange error. What notebook you were working on (local or coursera)? Did you pass the mode (in a temp_model = ... line) parameter since it’s not in the assignment?

I wondered the same thing, especially with conda in the exception path. I also am curious about the package structure since the on-line doc

https://trax-ml.readthedocs.io/en/latest/trax.layers.html#module-trax.layers.core

has trax.layers.core.Dense and not trax.layers.Dense. Unfortunately I can neither install locally on my Mac OS nor see the exercise source to dig deeper.

I was working on cousera.

I sent you a personal message. Please respond when you have time.

I’m having the same issue. Any help would be appreciated