Skip to content

fix:Add tiny granite vision model and update ReadMe for vision model support.#533

Merged
willmj merged 8 commits into
foundation-model-stack:mainfrom
Abhishek-TAMU:fix_vision_pr
Apr 22, 2025
Merged

fix:Add tiny granite vision model and update ReadMe for vision model support.#533
willmj merged 8 commits into
foundation-model-stack:mainfrom
Abhishek-TAMU:fix_vision_pr

Conversation

@Abhishek-TAMU
Copy link
Copy Markdown
Collaborator

@Abhishek-TAMU Abhishek-TAMU commented Apr 18, 2025

Description of the change

Fix for supporting vision model tuning.

Changes:

  • Removal of use_cache from AutoModelForVision2Seq.from_pretrained as vision model of type (MllamaForConditionalGeneration, LlavaForConditionalGeneration and LlavaNextForConditionalGeneration) doesn't support it.
  • ReadMe update to include LoRA tuning support of vision models along with Full fine tuning.
  • Added tiny granite vision model along with image dataset file.

Related issue number

Issue: https://github.ibm.com/ai-foundation/watson-fm-stack-tracker/issues/1610

How to verify the PR

Was the PR tested

  • I have added >=1 unit test(s) for every new method I have added.
  • I have ensured all unit tests pass

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>
Signed-off-by: Abhishek <maurya.abhishek@ibm.com>
Signed-off-by: Abhishek <maurya.abhishek@ibm.com>
@github-actions
Copy link
Copy Markdown

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions Bot added the fix label Apr 18, 2025
@Abhishek-TAMU
Copy link
Copy Markdown
Collaborator Author

Abhishek-TAMU commented Apr 18, 2025

@dushyantbehl Addition of tiny vision models and image dataset file in this PR would also be used in further v2 work in writing end-to-end unit test case as currently I couldn't write e2e test case as we just accept PIL format image as input and in v2 plan to accept PNG and JPEG image format.

### Constants used for model path
PREDEFINED_MODEL_PATH = os.path.join(os.path.dirname(__file__))
LLAMA_VISION_MODEL_NAME = os.path.join(PREDEFINED_MODEL_PATH, "tiny_llama_vision_model")
GRANITE_VISION_MODEL_NAME = os.path.join(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GRANITE_VISION_MODEL_NAME = os.path.join(
TINY_GRANITE_VISION_MODEL_NAME = os.path.join(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly for llama to tiny llama

Copy link
Copy Markdown
Collaborator

@dushyantbehl dushyantbehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor change

### Constants used for model path
PREDEFINED_MODEL_PATH = os.path.join(os.path.dirname(__file__))
LLAMA_VISION_MODEL_NAME = os.path.join(PREDEFINED_MODEL_PATH, "tiny_llama_vision_model")
GRANITE_VISION_MODEL_NAME = os.path.join(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly for llama to tiny llama

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>
dushyantbehl
dushyantbehl previously approved these changes Apr 22, 2025
Copy link
Copy Markdown
Collaborator

@dushyantbehl dushyantbehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @Abhishek-TAMU

@willmj up to you to merge post the tests pass.

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>
@willmj willmj merged commit b826c18 into foundation-model-stack:main Apr 22, 2025
9 checks passed
@Abhishek-TAMU Abhishek-TAMU deleted the fix_vision_pr branch April 22, 2025 20:38
dushyantbehl pushed a commit to dushyantbehl/fms-hf-tuning that referenced this pull request Jun 23, 2025
…support. (foundation-model-stack#533)

* Update readme and fix

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>

* Assign use_cache for vision model

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>

* tiny granite vision model and dataset with doc change

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>

* fix

* Change GRANITE_VISION_MODEL_NAME to TINY_GRANITE_VISION_MODEL_NAME

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>

* fmt/lint fix

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>

---------

Signed-off-by: Abhishek <maurya.abhishek@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants