After bumping torch to 2.11.0 in #23503, ty fails on examples/model-conversion/scripts/embedding/run-original-model.py:67 with unresolved-attribute on model[0].auto_model.config. The new torch stubs declare nn.Sequential.getitem as returning Tensor | Module rather than Module, and Tensor has no auto_model attribute, so ty cannot prove the access is safe. The runtime behavior is unchanged because SentenceTransformer always exposes a Module at index 0, but the static check reports the union access as unresolved.
A targeted unresolved-attribute ignore landed on that line in #23503 (commit 6fca63c) to keep CI green. The proper fix is to remove the ignore and type the variable explicitly, for example by pulling model[0] into a local annotated as Module or asserting isinstance(model[0], nn.Module) before the attribute access, so ty can narrow the union. I am happy to follow up with that change once the pin lands. Filing this so the ignore does not get forgotten.
After bumping torch to 2.11.0 in #23503, ty fails on examples/model-conversion/scripts/embedding/run-original-model.py:67 with unresolved-attribute on model[0].auto_model.config. The new torch stubs declare nn.Sequential.getitem as returning Tensor | Module rather than Module, and Tensor has no auto_model attribute, so ty cannot prove the access is safe. The runtime behavior is unchanged because SentenceTransformer always exposes a Module at index 0, but the static check reports the union access as unresolved.
A targeted unresolved-attribute ignore landed on that line in #23503 (commit 6fca63c) to keep CI green. The proper fix is to remove the ignore and type the variable explicitly, for example by pulling model[0] into a local annotated as Module or asserting isinstance(model[0], nn.Module) before the attribute access, so ty can narrow the union. I am happy to follow up with that change once the pin lands. Filing this so the ignore does not get forgotten.