Skip to content

pyright gcg: Cast a bunch of stuff#79

Merged
tomtseng merged 1 commit intomainfrom
tomtseng/gcg-casting
Feb 7, 2026
Merged

pyright gcg: Cast a bunch of stuff#79
tomtseng merged 1 commit intomainfrom
tomtseng/gcg-casting

Conversation

@tomtseng
Copy link
Collaborator

@tomtseng tomtseng commented Feb 7, 2026

Changes

Fix some pyright errors.

  • Imports: Added Callable, Any, cast from typing
  • Type fixes: callable → Callable[..., Any] | None, not_allowed_ids: Tensor = False → Tensor | None = None
  • embedding_layer: torch.nn.Module → torch.nn.Embedding (via cast)
  • Tokenizer calls: Wrapped 10 tokenizer(...)["input_ids"] patterns with cast(Tensor, ...) to handle Encoding stub mismatch
  • apply_chat_template: Added assert isinstance(template, str) + narrowed bos_token to str
  • init_buffer_ids: Declared init_buffer_ids: Tensor before if/else, changed logger.error to raise RuntimeError in except branch to ensure binding
  • spearmanr: Used pyright: ignore for incomplete scipy stubs

@tomtseng tomtseng merged commit 6ceccee into main Feb 7, 2026
1 of 2 checks passed
@tomtseng tomtseng deleted the tomtseng/gcg-casting branch February 7, 2026 05:39
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.

1 participant