simonJJJ commited on
Commit
ef917c8
1 Parent(s): 548275c

Update tokenization_qwen.py

Browse files
Files changed (1) hide show
  1. tokenization_qwen.py +1 -2
tokenization_qwen.py CHANGED
@@ -20,7 +20,6 @@ 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
25
  from matplotlib.font_manager import FontProperties
26
 
@@ -419,7 +418,7 @@ class QWenTokenizer(PreTrainedTokenizer):
419
  image = Image.open(requests.get(image, stream=True).raw).convert("RGB")
420
  h, w = image.height, image.width
421
  else:
422
- image = plt.imread(image)
423
  h, w = image.shape[0], image.shape[1]
424
  visualizer = Visualizer(image)
425
 
 
20
  from transformers import PreTrainedTokenizer, AddedToken
21
  from transformers.utils import try_to_load_from_cache
22
 
 
23
  import matplotlib.colors as mcolors
24
  from matplotlib.font_manager import FontProperties
25
 
 
418
  image = Image.open(requests.get(image, stream=True).raw).convert("RGB")
419
  h, w = image.height, image.width
420
  else:
421
+ image = np.asarray(Image.open(image).convert("RGB"))
422
  h, w = image.shape[0], image.shape[1]
423
  visualizer = Visualizer(image)
424