simonJJJ commited on
Commit
7c56786
1 Parent(s): f8ff4b9

fix font path

Browse files
Files changed (1) hide show
  1. tokenization_qwen.py +2 -3
tokenization_qwen.py CHANGED
@@ -169,7 +169,6 @@ class QWenTokenizer(PreTrainedTokenizer):
169
  self.eod_id = self.tokenizer.eot_token
170
  self.im_start_id = self.special_tokens[IMSTART]
171
  self.im_end_id = self.special_tokens[IMEND]
172
- self.font_path = os.path.dirname(__file__)
173
 
174
  def __len__(self) -> int:
175
  return self.tokenizer.n_vocab
@@ -417,7 +416,7 @@ class QWenTokenizer(PreTrainedTokenizer):
417
  else:
418
  image = plt.imread(image)
419
  h, w = image.shape[0], image.shape[1]
420
- visualizer = Visualizer(image, self.font_path)
421
 
422
  boxes = self._fetch_all_box_with_ref(response)
423
  if not boxes:
@@ -492,7 +491,7 @@ class VisImage:
492
 
493
 
494
  class Visualizer:
495
- def __init__(self, img_rgb, font_path, metadata=None, scale=1.0):
496
  self.img = np.asarray(img_rgb).clip(0, 255).astype(np.uint8)
497
  self.font_path = try_to_load_from_cache("Qwen/Qwen-VL-Chat", "SimSun.ttf")
498
  self.output = VisImage(self.img, scale=scale)
 
169
  self.eod_id = self.tokenizer.eot_token
170
  self.im_start_id = self.special_tokens[IMSTART]
171
  self.im_end_id = self.special_tokens[IMEND]
 
172
 
173
  def __len__(self) -> int:
174
  return self.tokenizer.n_vocab
 
416
  else:
417
  image = plt.imread(image)
418
  h, w = image.shape[0], image.shape[1]
419
+ visualizer = Visualizer(image)
420
 
421
  boxes = self._fetch_all_box_with_ref(response)
422
  if not boxes:
 
491
 
492
 
493
  class Visualizer:
494
+ def __init__(self, img_rgb, metadata=None, scale=1.0):
495
  self.img = np.asarray(img_rgb).clip(0, 255).astype(np.uint8)
496
  self.font_path = try_to_load_from_cache("Qwen/Qwen-VL-Chat", "SimSun.ttf")
497
  self.output = VisImage(self.img, scale=scale)