damccorm commented on code in PR #38374:
URL: https://github.com/apache/beam/pull/38374#discussion_r3241635229


##########
sdks/python/apache_beam/examples/inference/pytorch_sentiment.py:
##########
@@ -62,16 +59,34 @@ def process(self, element: tuple[str, PredictionResult]) -> 
Iterable[dict]:
     }
 
 
-def tokenize_text(text: str,
-                  tokenizer: DistilBertTokenizerFast) -> tuple[str, dict]:
-  """Tokenizes input text using the specified tokenizer."""
-  tokenized = tokenizer(
-      text,
-      padding='max_length',
-      truncation=True,
-      max_length=128,
-      return_tensors="pt")
-  return text, {k: torch.squeeze(v) for k, v in tokenized.items()}
+class TokenizeTextDoFn(beam.DoFn):

Review Comment:
   Could you update the pr description to contain all changes in this PR?



-- 
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]

Reply via email to