Skip to content

MIT 6.S191 Lab 1: Generate Music with PyTorch and an LSTM

Aug 22, 2026 1 min
TL;DR In the 2026 lab, students cover tensors, autograd, and modules before turning ABC notation into character sequences for LSTM music generation.
Table of Contents
  1. Before you begin
  2. Recommended sequence
  3. Completion criteria
  4. Limits
  5. References

🌏 中文版

Lab 1 in the official MIT 6.S191 2026 repository is Lab 1: Generate Music with PyTorch and an LSTM. It covers tensors, autograd, and modules before turning ABC notation into character sequences for LSTM music generation. This article pins the 2026 branch so later changes to master do not silently alter the exercise.

Before you begin

The official 2026 README specifies Google Colab, Python 3, and a GPU runtime. Copy the notebook to your Drive and run it from the beginning. Put API keys in the notebook's secret manager—never in a shareable cell or Git commit.

  1. Complete Part 1 TODOs and verify shapes and gradients
  2. Build the vocabulary, batches, and sequence model in Part 2
  3. Save a loss curve and one generated ABC/audio sample

Solve one TODO at a time. Write the expected input and output shapes before executing the cell; when something fails, preserve the error and your reason for the fix. Public solutions are for final comparison, not initial copying.

Expected outputs are a generally decreasing loss curve and a parseable ABC score or rendered audio sample. Common failures include shifting input/target sequences by the wrong offset and mixing CPU and GPU tensors during generation.

Completion criteria

Keep a notebook copy, one reproducible end-to-end run, and a short conclusion: what the model did correctly, where it failed, and which variable you would change next. A service-dashboard screenshot does not replace model outputs and an experiment record.

Limits

The official notebook uses a Google Colab GPU and asks for a Comet API key. Outside learners can complete the core TODOs but should not expect competition access or MIT feedback.

References