Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 101] Network is unreachable when doing inference with internlm-xcomposer2.5-7b #360

Closed
HuangZhen02 opened this issue Jul 9, 2024 · 7 comments
Assignees

Comments

@HuangZhen02
Copy link

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>

@panzhang0212
Copy link
Collaborator

I can access truetype_url .
Can your network access Hugging Face?

@resi1ience
Copy link

I can reach huggingface.co but encounter same issue......

@ygzhu
Copy link

ygzhu commented Jul 19, 2024

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

@resi1ience
Copy link

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

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

@ygzhu
Copy link

ygzhu commented Jul 19, 2024

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

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 in Step 2(The script in here will be saved in .cache dir)
  • Step 4 download 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 dir

@resi1ience
Copy link

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

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 in Step 2(The script in here will be saved in .cache dir)
  • Step 4 download 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 dir

Thank you for solution! It works!

@yuhangzang
Copy link
Collaborator

Thanks @ygzhu for providing the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants