-
Notifications
You must be signed in to change notification settings - Fork 74
feat: migrate from Granite 3 to Granite 4 hybrid models #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
8c9543e to
d19052b
Compare
|
Issue with HuggingFace tests
|
|
Looking at CI failures... |
1e70336 to
014c09d
Compare
- Migrate from Granite 3 to Granite 4 hybrid models - Document Granite 4 adapter limitations for HF tests - Add comprehensive HuggingFace adapter search results - Remove incorrect heavy_ram marker from test_spans.py - Revert HF tests to upstream approach (granite-3.3-8b, no env var) - Revert vision tests to granite3.2-vision due to Ollama crash - Map deprecated IBM_GRANITE_4_MICRO_3B to SMALL for watsonx support - Use MICRO model in Ollama tests to fit CI memory constraints - Restore per-backend model selection for IBM_GRANITE_4_MICRO_3B - Revert intrinsics examples to Granite 3.3 models
014c09d to
bc476b9
Compare
jakelorocco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Lets make sure all the intrinsics / adapters tests still run (let me know if you need help testing those). Those tests won't run during the github cicd, so we will need to run them manually.
| # backend._server_type = _ServerType.REMOTE_VLLM | ||
|
|
||
| backend = LocalHFBackend(model_id="ibm-granite/granite-3.3-8b-instruct") | ||
| backend = LocalHFBackend(model_id="ibm-granite/granite-4.0-tiny-preview") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: look at this part again.
| model_id="ibm-granite/granite-4.0-h-tiny", | ||
| formatter=TemplateFormatter(model_id="ibm-granite/granite-4.0-h-tiny"), | ||
| base_url="http://localhost:8000/v1", | ||
| api_key="EMPTY", | ||
| ) | ||
| backend.add_adapter( | ||
| GraniteCommonAdapter( | ||
| "requirement_check", base_model_name=backend.base_model_name | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you able to test if this (and the other) intrinsic / adapter tests still worked? I think in this case at least, there's no requirement_check adapter trained for this model?
| # Granite 4 Adapter Availability Analysis | ||
|
|
||
| ## Summary | ||
| **Finding**: HuggingFace tests CANNOT be migrated to Granite 4 because `requirement_check` adapter is not available for Granite 4 models. | ||
|
|
||
| **Comprehensive Search**: Searched all 180+ ibm-granite repositories on HuggingFace. Found 22 standalone adapter repositories, ALL for Granite 3.x. Zero Granite 4 standalone adapters exist. | ||
|
|
||
| ## Adapter Repository Types | ||
|
|
||
| ### 1. Consolidated Libraries (Multi-Intrinsic) | ||
| **ibm-granite/rag-intrinsics-lib** (Core Intrinsics): | ||
| - `requirement_check`: ❌ Granite 3.3 only (2b, 8b) | ||
| - `uncertainty`: ❌ Granite 3.3 only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this document should be removed.
Migrate from Granite 3.x to Granite 4.0 Models
Type of PR
Description
Summary
This PR migrates Mellea from Granite 3.x to Granite 4.0 hybrid models across all backends, tests, and documentation. Note: HuggingFace tests remain on Granite 3.3 due to adapter availability constraints (see below).
Changes
Model Definitions (
mellea/backends/model_ids.py)IBM_GRANITE_4_HYBRID_MICRO(granite-4.0-h-micro)IBM_GRANITE_4_HYBRID_TINY(granite-4.0-h-tiny)IBM_GRANITE_4_HYBRID_SMALL(granite-4-h-small)IBM_GRANITE_4_MICRO_3Bwith per-backend model selection (Ollama: MICRO, Watsonx: SMALL)IBM_GRANITE_3_3_VISION_2BBackend Updates
IBM_GRANITE_4_HYBRID_SMALLTest Updates (19 files)
✅ Migrated to Granite 4:
test/backends/test_watsonx.pytest/backends/test_ollama.pytest/backends/test_litellm_*.py(3 files)test/backends/test_vllm*.py(2 files)test/stdlib/components/*.py(8 files)test/stdlib/requirements/*.py(3 files)test/backends/test_huggingface.py- See "HuggingFace Test Exception" belowtest/backends/test_vision_ollama.py- See "Vision Model Exception" belowDocumentation Updates
docs/tutorial.md: Updated all examples to Granite 4docs/alora.md: Updated training examples, added note about non-hybrid models for adapter trainingdocs/examples/*.py: Updated all example scriptsTest Infrastructure
IBM_GRANITE_4_MICRO_3B(matches upstream pattern)HuggingFace Test Exception
HuggingFace tests remain on Granite 3.3 due to missing aLoRA adapters for Granite 4.
The HF tests require the
requirement_checkintrinsic adapter, which is only available for Granite 3.x models inibm-granite/rag-intrinsics-lib. Whileibm-granite/granite-lib-rag-r1.0has Granite 4 support for RAG intrinsics (answerability, context_relevance, etc.), the core intrinsics needed for tests are not yet available.Follow-up Issue: #359 tracks migration once Granite 4 adapters are released.
Vision Model Exception
Vision tests remain on
granite3.2-visiondue to Ollama compatibility issues.The
ibm/granite3.3-vision:2bmodel causes Ollama server crashes with segmentation fault (null pointer dereference in llama runner). Reverted togranite3.2-visionwhich works reliably.Follow-up Issue: #360 documents the crash with full stack traces and debugging information.
Testing
Local Testing
Test Results: 204 passed, 6 skipped, 69 deselected, 1 xpassed
CI Testing
All tests pass in CI with
CICD=1(skips qualitative markers).Related Issues