Skip to content

Fixing BS=1 handling#11

Merged
jannisborn merged 1 commit into
mainfrom
bs-1
Jun 21, 2026
Merged

Fixing BS=1 handling#11
jannisborn merged 1 commit into
mainfrom
bs-1

Conversation

@jannisborn

Copy link
Copy Markdown
Contributor

No description provided.

@kwehden

kwehden commented Jun 19, 2026

Copy link
Copy Markdown

The core fix looks correct. Argument-less `torch.squeeze()` drops every singleton dim, so with BS=1 the input `[1, seq_len, 1]` collapses to `[seq_len]` and the batch dimension is lost. `.squeeze(-1)` only removes the trailing dim, giving `[1, seq_len]` and preserving the batch — this is the right fix and is also safer in general.

Two follow-ups:

  1. Same bug remains in `scripts/test_toxsmi.py:203`:
    ```python
    yhat, pred_dict = model(torch.squeeze(x.to(device)))
    ```
    This is the identical pattern, so inference will still break at BS=1. Suggest applying the same `.squeeze(-1)` change here so BS=1 is fixed end-to-end.

  2. .gitignore nit (optional): the file is named `.DS_Store`, so the conventional entry is `.DS_Store` (or `**/.DS_Store`) rather than `*.DS_Store`; also missing a trailing newline.

LGTM to merge once the test script line is addressed.

@jannisborn jannisborn merged commit fe38257 into main Jun 21, 2026
1 check passed
@jannisborn jannisborn deleted the bs-1 branch June 21, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants