UncleFish commited on
Commit
9d698a7
1 Parent(s): e980750

update readme

Browse files
Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -44,7 +44,7 @@ class EosListStoppingCriteria(StoppingCriteria):
44
  # load models
45
  model_name_or_path = "Salesforce/blip3-phi3-3b-instruct-r-v1"
46
  model = AutoModelForVision2Seq.from_pretrained(model_name_or_path, trust_remote_code=True)
47
- tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True, use_fast=True, legacy=False)
48
  image_processor = AutoImageProcessor.from_pretrained(model_name_or_path, trust_remote_code=True)
49
  tokenizer = model.update_special_tokens(tokenizer)
50
 
@@ -64,7 +64,7 @@ generated_text = model.generate(**inputs, image_size=[raw_image.size],
64
  do_sample=False, max_new_tokens=768, top_p=None, num_beams=1,
65
  stopping_criteria = [EosListStoppingCriteria()],
66
  )
67
- prediction = tokenizer.decode(generated_text[0], skip_special_tokens=True)
68
  print("==> prediciton: ", prediction)
69
  # output: ==> prediciton: There is one dog in the picture.
70
  ```
 
44
  # load models
45
  model_name_or_path = "Salesforce/blip3-phi3-3b-instruct-r-v1"
46
  model = AutoModelForVision2Seq.from_pretrained(model_name_or_path, trust_remote_code=True)
47
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True, use_fast=False, legacy=False)
48
  image_processor = AutoImageProcessor.from_pretrained(model_name_or_path, trust_remote_code=True)
49
  tokenizer = model.update_special_tokens(tokenizer)
50
 
 
64
  do_sample=False, max_new_tokens=768, top_p=None, num_beams=1,
65
  stopping_criteria = [EosListStoppingCriteria()],
66
  )
67
+ prediction = tokenizer.decode(generated_text[0], skip_special_tokens=True).split("<|end|>")[0]
68
  print("==> prediciton: ", prediction)
69
  # output: ==> prediciton: There is one dog in the picture.
70
  ```