[GH-ISSUE #1684] [TinyTorch] Answers already in module 1 #19813

Open
opened 2026-06-01 18:22:36 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @bdub-1 on GitHub (May 5, 2026).
Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/1684

Module

01 Tensor

Type of Improvement

Code quality (refactor, style, consistency)

Description

The solutions were already implemented when I started module 1.

# Install TinyTorch (run from a project folder like ~/projects)
curl -sSL mlsysbook.ai/tinytorch/install.sh | bash

# Activate and verify
cd tinytorch
source .venv/bin/activate
tito setup

tito module start 01

Proposed Solution

Remove the implementations from the working notebooks.

Originally created by @bdub-1 on GitHub (May 5, 2026). Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/1684 ### Module 01 Tensor ### Type of Improvement Code quality (refactor, style, consistency) ### Description The solutions were already implemented when I started module 1. ``` # Install TinyTorch (run from a project folder like ~/projects) curl -sSL mlsysbook.ai/tinytorch/install.sh | bash # Activate and verify cd tinytorch source .venv/bin/activate tito setup tito module start 01 ``` ### Proposed Solution Remove the implementations from the working notebooks.
GiteaMirror added the area: booktype: improvementarea: tinytorchtype: bug labels 2026-06-01 18:22:37 -05:00
Author
Owner

@Shashank-Tripathi-07 commented on GitHub (May 5, 2026):

The solutions you are seeing are in the source file (src/01_tensor/01_tensor.py), which is the contributor-facing source of truth. The ### BEGIN SOLUTION / ### END SOLUTION markers are intentional nbgrader annotations.

When a student runs tito src export, these blocks get stripped out to generate the student-facing notebook with empty stubs. The GitHub source view always shows the full implementation by design.

To get the blank student version locally:

cd cs249r_book/tinytorch
tito src export 01

This generates the notebook in modules/01_tensor/ with only the TODO stubs visible. Not a bug, working as intended.

<!-- gh-comment-id:4380949453 --> @Shashank-Tripathi-07 commented on GitHub (May 5, 2026): The solutions you are seeing are in the **source file** (`src/01_tensor/01_tensor.py`), which is the contributor-facing source of truth. The `### BEGIN SOLUTION` / `### END SOLUTION` markers are intentional nbgrader annotations. When a student runs `tito src export`, these blocks get **stripped out** to generate the student-facing notebook with empty stubs. The GitHub source view always shows the full implementation by design. To get the blank student version locally: ```bash cd cs249r_book/tinytorch tito src export 01 ``` This generates the notebook in `modules/01_tensor/` with only the TODO stubs visible. Not a bug, working as intended.
Author
Owner

@bdub-1 commented on GitHub (May 5, 2026):

Thanks for the response. I used the quick start guide to being my module. I also don't see any mention of the this in the docs unless I missed it during the setup instructions. When I run tito --help there is no export command that shows up.

edit: I am following the student-learner role so I was confused why I am seeing the answers as my default. The TITO CLI module workflow page doesn't mention this either. I cannot get the blank version to generate so I am unsure if there actually is a bug. I saw a closed issue earlier of the same bug so I am wondering if the issue lingers

<!-- gh-comment-id:4381138846 --> @bdub-1 commented on GitHub (May 5, 2026): Thanks for the response. I used [the quick start guide](https://mlsysbook.ai/tinytorch/getting-started.html#start-the-module) to being my module. I also don't see any mention of the this in the docs unless I missed it during the setup instructions. When I run `tito --help` there is no `export` command that shows up. edit: I am following the [student-learner role](https://mlsysbook.ai/tinytorch/tito/overview.html#commands-by-user-role) so I was confused why I am seeing the answers as my default. The [TITO CLI module workflow page](https://mlsysbook.ai/tinytorch/tito/modules.html) doesn't mention this either. I cannot get the blank version to generate so I am unsure if there actually is a bug. I saw a closed issue earlier of the same bug so I am wondering if the issue lingers
Author
Owner

@Shashank-Tripathi-07 commented on GitHub (May 6, 2026):

This is a confirmed bug. When a student runs tito module start 01, the CLI was generating the notebook by passing the raw src/01_tensor/01_tensor.py file directly to jupytext with no stripping step. Every ### BEGIN SOLUTION / ### END SOLUTION block was carried over intact into the student notebook, so all answers were already filled in from the start.

The issue was in _create_module_from_src inside tinytorch/tito/commands/module/workflow.py. The function's own docstring acknowledged this behavior:

"Full src/ (including ### BEGIN SOLUTION ... ### END SOLUTION blocks) is passed through to jupytext"

The fix strips those solution blocks in memory before conversion. The source files in src/ are never touched. A temp directory is used to hold the stripped version, jupytext converts it to a notebook, and the temp dir is cleaned up automatically. Students now receive blank stubs with TODO comments, as intended.

PR: #1686

<!-- gh-comment-id:4384835228 --> @Shashank-Tripathi-07 commented on GitHub (May 6, 2026): This is a confirmed bug. When a student runs `tito module start 01`, the CLI was generating the notebook by passing the raw `src/01_tensor/01_tensor.py` file directly to jupytext with no stripping step. Every `### BEGIN SOLUTION` / `### END SOLUTION` block was carried over intact into the student notebook, so all answers were already filled in from the start. The issue was in `_create_module_from_src` inside `tinytorch/tito/commands/module/workflow.py`. The function's own docstring acknowledged this behavior: > "Full `src/` (including `### BEGIN SOLUTION` ... `### END SOLUTION` blocks) is passed through to jupytext" The fix strips those solution blocks in memory before conversion. The source files in `src/` are never touched. A temp directory is used to hold the stripped version, jupytext converts it to a notebook, and the temp dir is cleaned up automatically. Students now receive blank stubs with TODO comments, as intended. PR: #1686
Author
Owner

@Shashank-Tripathi-07 commented on GitHub (May 6, 2026):

Thanks for your attention to this bug @bdub-1 . I've made a PR and corrected this to make sure no future versions suffer from any problem like these !

We highly needed learner feedback for the project so that we can correct it further and better ! Thanks

<!-- gh-comment-id:4384840920 --> @Shashank-Tripathi-07 commented on GitHub (May 6, 2026): Thanks for your attention to this bug @bdub-1 . I've made a PR and corrected this to make sure no future versions suffer from any problem like these ! We highly needed learner feedback for the project so that we can correct it further and better ! Thanks
Author
Owner

@bdub-1 commented on GitHub (May 6, 2026):

Happy to help!

<!-- gh-comment-id:4385022872 --> @bdub-1 commented on GitHub (May 6, 2026): Happy to help!
Author
Owner

@profvjreddi commented on GitHub (May 25, 2026):

Thanks for the report @bdub-1. We're aware of this and plan to address it systematically in the next major TinyTorch release. The solution blocks in the working notebooks need to be stripped cleanly across all modules (not just module 01) as part of the tito module start workflow. Work is in progress — keeping this open to track.

<!-- gh-comment-id:4534970222 --> @profvjreddi commented on GitHub (May 25, 2026): Thanks for the report @bdub-1. We're aware of this and plan to address it systematically in the next major TinyTorch release. The solution blocks in the working notebooks need to be stripped cleanly across all modules (not just module 01) as part of the `tito module start` workflow. Work is in progress — keeping this open to track.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#19813