solve <SimSun.ttf> file loading issue
#11
by
tardis123
- opened
- tokenization_qwen.py +2 -1
tokenization_qwen.py
CHANGED
@@ -28,8 +28,9 @@ logger = logging.getLogger(__name__)
|
|
28 |
|
29 |
VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken", "ttf": "SimSun.ttf"}
|
30 |
FONT_PATH = try_to_load_from_cache("Qwen/Qwen-VL-Chat", "SimSun.ttf")
|
|
|
31 |
if FONT_PATH is None:
|
32 |
-
if not os.path.exists(
|
33 |
ttf = requests.get("https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/SimSun.ttf")
|
34 |
open("SimSun.ttf", "wb").write(ttf.content)
|
35 |
FONT_PATH = "SimSun.ttf"
|
|
|
28 |
|
29 |
VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken", "ttf": "SimSun.ttf"}
|
30 |
FONT_PATH = try_to_load_from_cache("Qwen/Qwen-VL-Chat", "SimSun.ttf")
|
31 |
+
ttf_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "SimSun.ttf")
|
32 |
if FONT_PATH is None:
|
33 |
+
if not os.path.exists(ttf_path):
|
34 |
ttf = requests.get("https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/SimSun.ttf")
|
35 |
open("SimSun.ttf", "wb").write(ttf.content)
|
36 |
FONT_PATH = "SimSun.ttf"
|