ShushengYang commited on
Commit
32e0f9a
1 Parent(s): a09908e

Update tokenization_qwen.py

Browse files

Download font ttf file if not exists

Files changed (1) hide show
  1. tokenization_qwen.py +5 -0
tokenization_qwen.py CHANGED
@@ -25,6 +25,11 @@ from matplotlib.font_manager import FontProperties
25
 
26
  logger = logging.getLogger(__name__)
27
 
 
 
 
 
 
28
 
29
  VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken", "ttf": "SimSun.ttf"}
30
 
 
25
 
26
  logger = logging.getLogger(__name__)
27
 
28
+ if not os.path.exists("SimSun.ttf"):
29
+ # download if not exists
30
+ logger.warning("SimSun font is required for Chinese display. Start downloading...")
31
+ print("wget https://ofasys-wlcb.oss-cn-wulanchabu.aliyuncs.com/Qwen-VL/SimSun.ttf")
32
+ os.system("wget https://ofasys-wlcb.oss-cn-wulanchabu.aliyuncs.com/Qwen-VL/SimSun.ttf")
33
 
34
  VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken", "ttf": "SimSun.ttf"}
35