simonJJJ commited on
Commit
f8ff4b9
1 Parent(s): 08d140b
Files changed (1) hide show
  1. tokenization_qwen.py +2 -1
tokenization_qwen.py CHANGED
@@ -18,6 +18,7 @@ from PIL import Image
18
  from PIL import ImageFont
19
  from PIL import ImageDraw
20
  from transformers import PreTrainedTokenizer, AddedToken
 
21
 
22
  import matplotlib.pyplot as plt
23
  import matplotlib.colors as mcolors
@@ -493,7 +494,7 @@ class VisImage:
493
  class Visualizer:
494
  def __init__(self, img_rgb, font_path, metadata=None, scale=1.0):
495
  self.img = np.asarray(img_rgb).clip(0, 255).astype(np.uint8)
496
- self.font_path = os.path.join(font_path, "SimSun.ttf")
497
  self.output = VisImage(self.img, scale=scale)
498
  self.cpu_device = torch.device("cpu")
499
 
 
18
  from PIL import ImageFont
19
  from PIL import ImageDraw
20
  from transformers import PreTrainedTokenizer, AddedToken
21
+ from transformers.utils import try_to_load_from_cache
22
 
23
  import matplotlib.pyplot as plt
24
  import matplotlib.colors as mcolors
 
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)
499
  self.cpu_device = torch.device("cpu")
500