feat: migrate from Granite 3 to Granite 4 hybrid models#357
feat: migrate from Granite 3 to Granite 4 hybrid models#357planetf1 wants to merge 6 commits intogenerative-computing:mainfrom
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
014c09d to
bc476b9
Compare
jakelorocco
left a comment
There was a problem hiding this comment.
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.
Note to self: look at this part again.
There was a problem hiding this comment.
Just now realized this slipped through. I think this was about whether the intrinsic existed for this model as mentioned below.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I needed #397 to reliably run the tests in a suitable environment (useful when this is merged).
Temporarily I've cherry-picked the commit here & was able to run all the hugging face tests that are active (examples & tests). This is require reverting some of the tests to the granite3.x models -- as some were dependent on adapters that are not yet available. Issue #359 was already open to track that update.
I've also reverted this change. (don't yet have vllm setup - another todo)
|
Will look at this tomorrow as I now have a suitable environment |
- Update to Granite 4 hybrid models where possible (non-intrinsic tests) - Update watsonx backend to use IBM_GRANITE_4_HYBRID_SMALL as default - Add note in alora.md: use non-hybrid models for adapter training - Remove heavy_ram marker from tests using 3B models (only needed for 8B+) - Update model_ids.py with Granite 4 model mappings and deprecation handling
bc476b9 to
3b86b9e
Compare
- Add @pytest.mark.ollama to tests requiring Ollama backend - Update test/README.md with comprehensive marker documentation - Update .gitignore for logs/ and pytest output files
Reverting to match upstream/main to verify if granite-4.0-micro works. Previous commit used granite-3.3-8b-instruct based on assumption that Granite 4 adapters don't exist, but PR generative-computing#397 suggests granite-4.0-micro may work. Testing to confirm.
…am/main) All intrinsics examples were incorrectly changed to granite-3.3-2b-instruct in commit 3b86b9e, but adapters don't exist for the 2B model. Reverting to granite-4.0-micro which has adapters in ibm-granite/granite-lib-rag-r1.0. This matches upstream/main and allows all intrinsics examples to run successfully.
…am/main)
The requirement_check adapter only exists for granite-3.3-{2b,8b}-instruct
models in ibm-granite/rag-intrinsics-lib, not for granite-4.0-micro.
Upstream/main uses granite-3.3-8b-instruct which has the required adapter.
…ain)
The requirement_check adapter only exists for granite-3.3-{2b,8b}-instruct
models, not for granite-4.0-h-tiny. Upstream/main uses granite-3.3-8b-instruct
which has the required adapter in ibm-granite/rag-intrinsics-lib.
|
Suggestion: If we can agree/merge #397 I will then rebase this PR, resolve conflicts, and rerun the full suite locally + hugging face remotely. |
I've approved it! |
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