This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-6809-02fe9c7cb5dabe5374b3e858660e0b85890da57d
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 2ae9a97363b8fb5f4c29fa8a7fa88fb7c8fbd27a
Author: Kary Zheng <[email protected]>
AuthorDate: Tue Aug 4 17:03:16 2026 -0700

    fix(HuggingFace): drop unused TensorFlow import in sentiment analysis 
codegen (#6809)
    
    ### What changes were proposed in this PR?
    
    `HuggingFaceSentimentAnalysisOpDesc.generatePythonCode` emitted an
    import for `TFAutoModelForSequenceClassification` that the generated
    body never uses — the model is loaded through the PyTorch
    `AutoModelForSequenceClassification`.
    
    The symbol does not exist in the pinned `transformers`: the library
    dropped its TensorFlow backend in 5.0, and
    `amber/operator-requirements.txt` has been on 5.x since #5016 (5.5.0
    today). So the import is not dead weight — it raises `ImportError` at
    module load and takes the whole generated script down before any
    inference runs, on every environment that installs the pinned
    requirements.
    
    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?
    
    Manually, per @Yicong-Huang's request: the existing spec asserts on the
    emitted text and `py_compile` only parses it, so neither executes the
    template.
    
    The template was dumped from `generatePythonCode` (columns `text` →
    `pos`/`neu`/`neg`) and run against the `pytexera` in
    `amber/src/main/python`, in a virtualenv with the pinned `transformers`
    5.5.0 and `numpy` 2.1.0. main's stops at line 4 with `ImportError:
    cannot import name 'TFAutoModelForSequenceClassification' from
    'transformers'`, before the class body is defined; this PR's loads
    `cardiffnlp/twitter-roberta-base-sentiment-latest` and classifies all
    three rows, each row's three columns summing to 1:
    
    | text | pos | neu | neg |
    | --- | --- | --- | --- |
    | I love this new feature, it works beautifully! | 0.9884 | 0.007 |
    0.0046 |
    | The meeting is scheduled for 3pm in room 204. | 0.0433 | 0.9438 |
    0.0129 |
    | This is the worst release we have ever shipped. | 0.0066 | 0.0423 |
    0.951 |
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (Claude Opus 4.8)
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 <[email protected]>
    Co-authored-by: carloea2 <[email protected]>
    Co-authored-by: Yicong Huang 
<[email protected]>
    Co-authored-by: Xuan Gu <[email protected]>
---
 .../amber/operator/huggingFace/HuggingFaceSentimentAnalysisOpDesc.scala  | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceSentimentAnalysisOpDesc.scala
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceSentimentAnalysisOpDesc.scala
index 1d6cc7be9c..d60f1f33ea 100644
--- 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceSentimentAnalysisOpDesc.scala
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceSentimentAnalysisOpDesc.scala
@@ -61,7 +61,6 @@ class HuggingFaceSentimentAnalysisOpDesc extends 
PythonOperatorDescriptor {
     pyb"""from pytexera import *
        |from transformers import pipeline
        |from transformers import AutoModelForSequenceClassification
-       |from transformers import TFAutoModelForSequenceClassification
        |from transformers import AutoTokenizer, AutoConfig
        |import numpy as np
        |from scipy.special import softmax

Reply via email to