Skip to content

TF_Part2_Music_Generation 2.6 model.reset_states() Error #174

Open
@reeeeemo

Description

@reeeeemo

In the function generate_text (section 2.6, lab1/TF_Part2_Music_Generation), there is this code snippet:

  # Here batch size == 1
  model.reset_states()
  tqdm._instances.clear()

However, our model is a Sequential model, with an LSTM layer. I get the error model.reset_states() does not exist in tf.keras.models.Sequential. My workaround is changing the code snippet from previous to this:

  # Here batch size == 1
  for layer in model.layers:
      if hasattr(layer, 'reset_states'):
          layer.reset_states()
  tqdm._instances.clear()

Just posting if anyone else gets this error! Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions