feat(frontend): add HuggingFace task selector and model browser component#5566
feat(frontend): add HuggingFace task selector and model browser component#5566ELin2025 wants to merge 18 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5566 +/- ##
============================================
- Coverage 54.09% 53.68% -0.41%
- Complexity 2817 2822 +5
============================================
Files 1103 1106 +3
Lines 42650 43065 +415
Branches 4588 4654 +66
============================================
+ Hits 23070 23120 +50
- Misses 18236 18600 +364
- Partials 1344 1345 +1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/request-review @Ma77Ball |
1 similar comment
|
/request-review @Ma77Ball |
Ma77Ball
left a comment
There was a problem hiding this comment.
Left comments, please ignore if implemented later or push those changes here.
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 417 | 0.255 | 24,069/30,842/30,842 us | 🔴 +21.2% / 🟢 -11.8% |
| 🔴 | bs=100 sw=10 sl=64 | 930 | 0.567 | 105,804/137,787/137,787 us | 🔴 +6.0% / 🟢 -5.8% |
| ⚪ | bs=1000 sw=10 sl=64 | 1,081 | 0.66 | 930,922/961,076/961,076 us | ⚪ within ±5% / 🟢 -6.1% |
Baseline details
Latest main 8803d08 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 417 tuples/sec | 446 tuples/sec | 410.82 tuples/sec | -6.5% | +1.5% |
| bs=10 sw=10 sl=64 | MB/s | 0.255 MB/s | 0.272 MB/s | 0.251 MB/s | -6.3% | +1.7% |
| bs=10 sw=10 sl=64 | p50 | 24,069 us | 19,866 us | 23,785 us | +21.2% | +1.2% |
| bs=10 sw=10 sl=64 | p95 | 30,842 us | 39,152 us | 34,980 us | -21.2% | -11.8% |
| bs=10 sw=10 sl=64 | p99 | 30,842 us | 39,152 us | 34,980 us | -21.2% | -11.8% |
| bs=100 sw=10 sl=64 | throughput | 930 tuples/sec | 942 tuples/sec | 891.94 tuples/sec | -1.3% | +4.3% |
| bs=100 sw=10 sl=64 | MB/s | 0.567 MB/s | 0.575 MB/s | 0.544 MB/s | -1.4% | +4.2% |
| bs=100 sw=10 sl=64 | p50 | 105,804 us | 105,060 us | 112,277 us | +0.7% | -5.8% |
| bs=100 sw=10 sl=64 | p95 | 137,787 us | 129,991 us | 139,802 us | +6.0% | -1.4% |
| bs=100 sw=10 sl=64 | p99 | 137,787 us | 129,991 us | 139,802 us | +6.0% | -1.4% |
| bs=1000 sw=10 sl=64 | throughput | 1,081 tuples/sec | 1,110 tuples/sec | 1,041 tuples/sec | -2.6% | +3.8% |
| bs=1000 sw=10 sl=64 | MB/s | 0.66 MB/s | 0.678 MB/s | 0.635 MB/s | -2.7% | +3.9% |
| bs=1000 sw=10 sl=64 | p50 | 930,922 us | 899,720 us | 972,714 us | +3.5% | -4.3% |
| bs=1000 sw=10 sl=64 | p95 | 961,076 us | 954,094 us | 1,023,057 us | +0.7% | -6.1% |
| bs=1000 sw=10 sl=64 | p99 | 961,076 us | 954,094 us | 1,023,057 us | +0.7% | -6.1% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,479.06,200,128000,417,0.255,24068.70,30842.45,30842.45
1,100,10,64,20,2151.52,2000,1280000,930,0.567,105804.39,137787.10,137787.10
2,1000,10,64,20,18493.68,20000,12800000,1081,0.660,930921.52,961075.61,961075.61
Ma77Ball
left a comment
There was a problem hiding this comment.
Resolved since the last round:
- interval/timeout handles tracked and cleared in ngOnDestroy
- dead TASK_TAG_MAP/TASK_NAMES removed
- truncation header read via observe: response, server-side search wired
- inFlightByTag now used for dedup
- tasks fetch resets its guard on cancellation via finalize
One item left, inline (suggestion). Static review only, not built or run.
@xuang7, can you review?
b132cde to
775f26c
Compare
775f26c to
b132cde
Compare
b132cde to
3e4c858
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Angular Formly field for configuring HuggingFace inference (task selection + model browsing) and expands the HuggingFace operator backend codegen/task coverage (image/audio/media-gen + QA/ranking), including updated Scala tests.
Changes:
- Frontend: introduce
HuggingFaceComponent(task dropdown + model list/search/pagination + per-task state preservation) andHuggingFaceImageUploadComponent, and register them as Formly field types. - Backend: extend HuggingFace codegen dispatcher and Python template to support additional task families (image/audio/media-gen/QA+ranking) plus new operator properties for those tasks.
- Tests: add/extend unit tests for both the frontend components and backend operator descriptor/codegen.
Reviewed changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/app/workspace/component/hugging-face/hugging-face.component.ts | New Formly field component that fetches HF tasks/models, caches results, supports search/pagination, and preserves task-scoped form state. |
| frontend/src/app/workspace/component/hugging-face/hugging-face.component.html | Template for task selector, model browser, search, and pagination UI. |
| frontend/src/app/workspace/component/hugging-face/hugging-face.component.scss | Styles for the HuggingFace selector/model list UI. |
| frontend/src/app/workspace/component/hugging-face/hugging-face.component.spec.ts | Unit tests covering the static task list and cache invalidation helper. |
| frontend/src/app/workspace/component/hugging-face-image-upload/hugging-face-image-upload.component.ts | New image upload Formly field with client-side compression and data-url storage. |
| frontend/src/app/workspace/component/hugging-face-image-upload/hugging-face-image-upload.component.html | Template for image upload + preview + clear UX. |
| frontend/src/app/workspace/component/hugging-face-image-upload/hugging-face-image-upload.component.scss | Styles for the image upload component. |
| frontend/src/app/workspace/component/hugging-face-image-upload/hugging-face-image-upload.component.spec.ts | Unit tests for derived state, invalid file handling, and clear behavior. |
| frontend/src/app/common/formly/formly-config.ts | Registers new Formly field types: huggingface and huggingface-image-upload. |
| frontend/src/app/app.module.ts | Declares the new HuggingFace components. |
| common/workflow-operator/src/main/scala/.../HuggingFaceInferenceOpDesc.scala | Adds new operator properties and registers multiple task-family codegens in the dispatcher. |
| common/workflow-operator/src/main/scala/.../codegen/TaskCodegen.scala | Extends CodegenContext and introduces a multi-task tasks API for codegens. |
| common/workflow-operator/src/main/scala/.../codegen/PythonCodegenBase.scala | Expands generated Python with provider routing + image/audio/media helpers and new runtime validation logic. |
| common/workflow-operator/src/main/scala/.../codegen/QaRankingCodegen.scala | New QA/ranking task codegen (payload + response parsing). |
| common/workflow-operator/src/main/scala/.../codegen/ImageTaskCodegen.scala | New image task-family codegen handling raw-binary and image+prompt payloads. |
| common/workflow-operator/src/main/scala/.../codegen/AudioTaskCodegen.scala | New audio task-family codegen supporting raw-binary audio and TTS parsing. |
| common/workflow-operator/src/main/scala/.../codegen/MediaGenCodegen.scala | New prompt-driven media generation codegen with URL/b64 normalization. |
| common/workflow-operator/src/test/scala/.../HuggingFaceInferenceOpDescSpec.scala | Adds extensive task-family coverage assertions for generated Python code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a65a8db to
b37ca09
Compare
…nent Register the huggingface formly field type and declare HuggingFaceComponent in AppModule. Provides a task dropdown, paginated model list with client-side search, and per-task field state preservation when switching tasks.
The rxjs/no-implicit-any-catch ESLint rule requires explicit type annotations on error callbacks in .subscribe() calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mponent Satisfies the rxjs-angular/prefer-takeuntil lint rule. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mponent Fix setInterval/setTimeout leaks by tracking timer IDs and clearing them in ngOnDestroy. Remove takeUntil(destroy$) from shared module-level task fetch to prevent cache poisoning when the initiating component is destroyed. Remove unused TASK_TAG_MAP and TASK_NAMES exports. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…FaceComponent inFlightByTag was written but never read, so multiple component instances mounting for the same uncached task would each fire a full backend request. Add an in-flight guard that polls for the existing request's completion, matching the pattern already used for task fetches. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… in HuggingFaceComponent
Read X-Texera-Truncated header via { observe: "response" } to detect
when the backend's model list is incomplete. Show a notice prompting
users to search. When truncated, search queries are sent to the backend
search endpoint with debounce; otherwise local filtering is used.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…r lint rule Add back destroy$ and takeUntil(this.destroy$) on all subscribe calls. For the shared task fetch, add finalize() to reset tasksFetchSubscription when takeUntil fires before next/error, preventing the stale-guard bug the reviewer originally flagged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…anup Mirror the defensive pattern from the tasks fetch so that when takeUntil(destroy$) cancels mid-flight, inFlightByTag is cleared and subsequent component instances can re-fetch instead of polling forever. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Elliot Lin <36275109+ELin2025@users.noreply.github.com>
- Fix model polling indefinite loop by detecting cancelled in-flight fetch - Fix CSS class mismatch: hf-tasks-error → hf-error to match SCSS - Remove unused imports in spec file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Catch HTTP errors inside switchMap so search stream survives failures - Use empty string instead of null when clearing model selection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7889a13 to
c5f75b9
Compare
Automated Reviewer SuggestionsBased on the
|
What changes were proposed in this PR?
Add
HuggingFaceComponent, a custom formly field type (huggingface) that provides:/huggingface/tasksendpoint, with a static fallback list)/huggingface/modelsendpoint (which proxies HuggingFace Hub)This PR registers the component in
formly-config.tsand declares it inAppModule. The component is not yet wired into the HuggingFace operator's property editor; thejsonSchemaMapInterceptmapping that routes themodelIdfield to this component is added in the follow-up property-editor PR (PR 7).Any related issues, documentation, discussions?
How was this PR tested?
7 unit tests added in
hugging-face.component.spec.tscovering:Run with
ng test.Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.7