Closed HuangZhen02 closed 2 months ago
I can access truetype_url . Can your network access Hugging Face?
I can reach huggingface.co but encounter same issue......
Download the SimHei.ttf
from Hugging Face and set the local path in get_font()
. you can refer the code as follow.
def get_font():
ff = "/Path_of_SimHei/SimHei.ttf"
font = ImageFont.truetype(ff, size=40)
return font
Download the
SimHei.ttf
from Hugging Face and set the local path inget_font()
. you can refer the code as follow.def get_font(): ff = "/Path_of_SimHei/SimHei.ttf" font = ImageFont.truetype(ff, size=40) return font
Thank you for solution, but I discover that ixc_utils.py would automatically be reset when running the demo, and I'm wonder how to solve it
Download the
SimHei.ttf
from Hugging Face and set the local path inget_font()
. you can refer the code as follow.def get_font(): ff = "/Path_of_SimHei/SimHei.ttf" font = ImageFont.truetype(ff, size=40) return font
Thank you for solution, but I discover that ixc_utils.py would automatically be reset when running the demo, and I'm wonder how to solve it
Check the step:
.cache
dir example_code.py
refer to the path in Step 2
(The script in here will be saved in .cache dir)SimHei.ttf
and rectify the path in get_font()
just run the code, if some model cannot be load from Hugging Face
, just follow Step 1 to Step 3, download the model in Hugging Face
and rectify the model path in related script, remember to clear the .cache
dirDownload the
SimHei.ttf
from Hugging Face and set the local path inget_font()
. you can refer the code as follow.def get_font(): ff = "/Path_of_SimHei/SimHei.ttf" font = ImageFont.truetype(ff, size=40) return font
Thank you for solution, but I discover that ixc_utils.py would automatically be reset when running the demo, and I'm wonder how to solve it
Check the step:
- Step 0 clear the
.cache
dir- Step 1 clone the github repo in your local machine
- Step 2 clone the Hugging Face in your local machine
- Step 3 rectify the pretrained model path in
example_code.py
refer to the path inStep 2
(The script in here will be saved in .cache dir)- Step 4 download
SimHei.ttf
and rectify the path inget_font()
just run the code, if some model cannot be load fromHugging Face
, just follow Step 1 to Step 3, download the model inHugging Face
and rectify the model path in related script, remember to clear the.cache
dir
Thank you for solution! It works!
Thanks @ygzhu for providing the solution.
when loading the model, it seems that the function
get_fond()
in ixc_utils.py will be run. However, some errors occurred:def get_font(): truetype_url = 'https://huggingface.co/internlm/internlm-xcomposer2d5-7b/resolve/main/SimHei.ttf?download=true' ff = urlopen(truetype_url) font = ImageFont.truetype(ff, size=40) return font
<urlopen error [Errno 101] Network is unreachable> OSError: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred: File "/data/zhuang/huggingface/misc/modules/transformers_modules/internlm-xcomposer2d5-7b/ixc_utils.py", line 13, in get_font ff = urlopen(truetype_url) File "/data/zhuang/huggingface/misc/modules/transformers_modules/internlm-xcomposer2d5-7b/modeling_internlm_xcomposer2.py", line 105, in init self.font = get_font() ......
urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>