Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Oct 14, 2024
1 parent a0fcbcc commit b6feebf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lmdeploy/lite/apis/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,21 @@ class name or the class type itself.
print(f'Move {mod_name} to GPU.')



# TODO to be removed
def make_compatible_internvl_config(model_path):
"""Patch model.config since after transformers v4.45.0,
InternVL models can't use `save_pretrained`"""
"""Patch model.config since after transformers v4.45.0, InternVL models
can't use `save_pretrained`"""
if 'internvl' in model_path.lower():
import transformers
from packaging import version
if version.parse(transformers.__version__) >=version.parse('4.45.0'):
if version.parse(transformers.__version__) >= version.parse('4.45.0'):

def _get_non_default_generation_parameters(self):
return {}

from transformers import PretrainedConfig
PretrainedConfig._get_non_default_generation_parameters = _get_non_default_generation_parameters # noqa
PretrainedConfig._get_non_default_generation_parameters = _get_non_default_generation_parameters # noqa


def calibrate(model: str,
calib_dataset: str = 'ptb',
Expand Down

0 comments on commit b6feebf

Please sign in to comment.