Fix/transformers runtime patch#2
Open
wildcraft958 wants to merge 3 commits into
Open
Conversation
- LISAT.py: Add transformers version patch, use kwargs.get() with defaults - builder.py: Fallback to openai/clip-vit-large-patch14 when saved path doesn't exist Fixes issues reported in GitHub: missing train_mask_decoder kwargs, hardcoded vision tower paths from original author's machine causing ValueError.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes several issues that prevent loading pretrained LISAT models in different environments.
Problems Fixed
1.
ValueError: Unknown vision tower: /home/patrickwu/...The saved model config contains hardcoded absolute paths from the original training machine. When users download the model, this path doesn't exist.
Fix:
builder.pynow falls back toopenai/clip-vit-large-patch14when the config path doesn't exist locally.2.
KeyError: 'train_mask_decoder'During inference loading via
from_pretrained(), kwargs liketrain_mask_decoderandout_dimaren't passed, causing a KeyError.Fix:
LISAT.pyandLISAT_eval.pynow usekwargs.get()with sensible defaults.3. Transformers version/registration errors
Strict version checks in
transformerscauseImportErrorat import time. Additionally, duplicateAutoConfig.registercalls raiseValueError: already used.Fix: Runtime monkey-patch disables strict version checks before importing transformers, and wraps registration methods to ignore duplicates.
Files Changed
model/LISAT.py— kwargs defaults + transformers patchmodel/LISAT_eval.py— kwargs defaults + transformers patchmodel/llava/model/multimodal_encoder/builder.py— vision tower fallbackTesting
py_compileContribution by @wildcraft958