kz930 opened a new pull request, #6809:
URL: https://github.com/apache/texera/pull/6809
### What changes were proposed in this PR?
`HuggingFaceSentimentAnalysisOpDesc.generatePythonCode` emitted an import
for `TFAutoModelForSequenceClassification` that is never used — the generated
body loads the model with the PyTorch `AutoModelForSequenceClassification` and
uses `pipeline`.
The `TF*` classes belong to `transformers`' TensorFlow backend, so importing
this symbol forces a TensorFlow dependency. In a PyTorch-only environment (what
the operator actually uses), the import raises at module load and **crashes the
whole generated script** before any inference runs.
Fix — remove the unused import:
```diff
from transformers import pipeline
from transformers import AutoModelForSequenceClassification
-from transformers import TFAutoModelForSequenceClassification
from transformers import AutoTokenizer, AutoConfig
```
### Any related issues, documentation, discussions?
Closes #6794
### How was this PR tested?
Added a regression test in `HuggingFaceSentimentAnalysisOpDescSpec`
asserting `generatePythonCode()` no longer contains
`TFAutoModelForSequenceClassification` while still importing the PyTorch
`AutoModelForSequenceClassification` it uses. Verified it **fails** on the
pre-fix code and **passes** with the fix; full
`HuggingFaceSentimentAnalysisOpDescSpec` is green (8/8).
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]