tinyllava commited on
Commit
22d0c6c
1 Parent(s): 829cb99

Update generate_model.py

Browse files
Files changed (1) hide show
  1. generate_model.py +1 -23
generate_model.py CHANGED
@@ -594,7 +594,7 @@ def generate(
594
  # print('model load over')
595
  config = model.config
596
  if tokenizer is None:
597
- tokenizer = AutoTokenizer.from_pretrained(model, use_fast=False, model_max_length = config.tokenizer_model_max_length,
598
  padding_side = config.tokenizer_padding_side)
599
  image_processor = model.vision_tower._image_processor
600
  context_len = getattr(config, 'max_sequence_length', 2048)
@@ -653,28 +653,6 @@ def generate(
653
  def tinyllava_phi_generate_parser():
654
  """Argument Parser"""
655
 
656
- class KwargsParser(argparse.Action):
657
- """Parser action class to parse kwargs of form key=value"""
658
- def __call__(self, parser, namespace, values, option_string=None):
659
- setattr(namespace, self.dest, dict())
660
- for val in values:
661
- if '=' not in val:
662
- raise ValueError(
663
- (
664
- 'Argument parsing error, kwargs are expected in'
665
- ' the form of key=value.'
666
- )
667
- )
668
- kwarg_k, kwarg_v = val.split('=')
669
- try:
670
- converted_v = int(kwarg_v)
671
- except ValueError:
672
- try:
673
- converted_v = float(kwarg_v)
674
- except ValueError:
675
- converted_v = kwarg_v
676
- getattr(namespace, self.dest)[kwarg_k] = converted_v
677
-
678
  parser = argparse.ArgumentParser('TinyLLaVA-Phi Generate Module')
679
  parser.add_argument(
680
  '--model',
 
594
  # print('model load over')
595
  config = model.config
596
  if tokenizer is None:
597
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint_path, use_fast=False, model_max_length = config.tokenizer_model_max_length,
598
  padding_side = config.tokenizer_padding_side)
599
  image_processor = model.vision_tower._image_processor
600
  context_len = getattr(config, 'max_sequence_length', 2048)
 
653
  def tinyllava_phi_generate_parser():
654
  """Argument Parser"""
655
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
  parser = argparse.ArgumentParser('TinyLLaVA-Phi Generate Module')
657
  parser.add_argument(
658
  '--model',