CAMEL-24540: camel-huggingface - honour model revision for sentence-embeddings/text-to-image and set the text-to-image OUTPUT header - #25933
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
999093f to
a11f7ea
Compare
…ce-embeddings and text-to-image, and set the text-to-image OUTPUT header Two small correctness gaps in the task predictors: - The configured model revision was dropped by SentenceEmbeddingsPredictor and TextToImagePredictor; the other eight tasks pass config.getRevision() into their Python script, so pinning a revision silently had no effect for these two. Pass the revision into sentence_embeddings.py (SentenceTransformer) and text_to_image.py (StableDiffusionPipeline.from_pretrained). - TextToImagePredictor set the image bytes as the body but never set the OUTPUT header, although its Javadoc documents it. Set HuggingFaceConstants.OUTPUT to the image bytes alongside the body. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
a11f7ea to
3a277e0
Compare
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 tested, 27 compile-only — current: 9 all testedMaveniverse Scalpel detected 36 affected modules (current approach: 9).
|
gnodet
left a comment
There was a problem hiding this comment.
Clean, correct bug fix that adds the missing config.getRevision() parameter to the only two predictors that omitted it (SentenceEmbeddingsPredictor and TextToImagePredictor), and adds the missing OUTPUT header to TextToImagePredictor, bringing both in line with the other eight predictors.
Verified:
%splaceholder ordering in both Python scripts matches the Java argument order- The revision field defaults to
"main"(never null), so the Python substitution is safe - The OUTPUT header addition is consistent with all other 9 predictors
🔀 Backport Status
camel-huggingface component was introduced in 4.19.0 and this bug has existed since inception. Consider backporting to camel-4.22.x (component does not exist in camel-4.18.x).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Issue
CAMEL-24540
Two small correctness gaps in the Hugging Face task predictors, both incomplete ports of the pattern
the other predictors follow.
1. Model revision ignored for two tasks
SentenceEmbeddingsPredictorandTextToImagePredictordid not passconfig.getRevision()into theirgenerated Python script, so pinning a model revision/branch silently had no effect for these two tasks
(the other eight pass it). The revision is now threaded into:
sentence_embeddings.py—SentenceTransformer(model, device=..., revision=...)text_to_image.py—StableDiffusionPipeline.from_pretrained(model, revision=..., ...)2. Text-to-image never set the OUTPUT header
TextToImagePredictor.processOutputset the image bytes as the message body but never set theOUTPUTheader, even though its Javadoc documents that header. It now setsHuggingFaceConstants.OUTPUTto the image bytes alongside the body.Testing
RevisionAndOutputHeaderTestasserts both scripts pin the configured revision and thattext-to-image publishes the image on the
OUTPUTheader.mvn -Psourcecheck validategreen.Claude Code on behalf of oscerd