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

bert 客户端无法远程访问到server #846

Open
rickyhuw opened this issue Aug 25, 2020 · 8 comments
Open

bert 客户端无法远程访问到server #846

rickyhuw opened this issue Aug 25, 2020 · 8 comments
Assignees
Labels
serving Issues of hub serving

Comments

@rickyhuw
Copy link

使用127.0.0.1这个IP是可以访问的,切换到本机IP就无法访问了。
报错日志:
Traceback (most recent call last):
File "1.py", line 6, in
bc = bs_client.BSClient(module_name="ernie_tiny", server="10.19.141.148:8866")
File "/home/work/.local/lib/python3.6/site-packages/paddlehub/serving/bert_serving/bs_client.py", line 18, in init
self.bs.add_server(server=server)
File "/home/work/.local/lib/python3.6/site-packages/paddlehub/serving/bert_serving/bert_service.py", line 76, in add_server
self.check_server()
File "/home/work/.local/lib/python3.6/site-packages/paddlehub/serving/bert_serving/bert_service.py", line 88, in check_server
client.connect((server_ip, server_port))
ConnectionRefusedError: [Errno 111] Connection refused

demo 代码:

coding: utf8

from paddlehub.serving.bert_serving import bs_client

if name == "main":
# 初始化bert_service客户端BSClient
bc = bs_client.BSClient(module_name="ernie_tiny", server="10.19.141.148:8866")

# 输入要做embedding的文本
# 文本格式为[["文本1"], ["文本2"], ]
input_text = [
    ["西风吹老洞庭波"],
    ["一夜湘君白发多"],
    ["醉后不知天在水"],
    ["满船清梦压星河"],
]

# BSClient.get_result()获取结果
result = bc.get_result(input_text=input_text)

# 打印输入文本的embedding结果
for item in result:
    print(item)
@livingbody
Copy link

livingbody commented Aug 25, 2020 via email

@rickyhuw
Copy link
Author

我用netstat -tunlp 查看了监听接口,发现这个服务只是监听了127.0.0.1,所以没有办法通过本机IP访问,那这个配置在哪里修改呢?
image

@Steffy-zxf Steffy-zxf added the serving Issues of hub serving label Aug 26, 2020
@ShenYuhan
Copy link
Contributor

在启动的时候增加参数 --host XX.XX.XX.XXX

@rickyhuw
Copy link
Author

rickyhuw commented Aug 26, 2020

是我的版本问题吗?,提示没有host这个参数,希望得到您的解答,谢谢。
image
image

@ultimatedaotu
Copy link

兄弟你解决了没有哇 ubuntu18.04 按照教程客户端访问不了 报错list index out of range 浏览器可以访问

@rickyhuw
Copy link
Author

rickyhuw commented Sep 8, 2020

兄弟你解决了没有哇 ubuntu18.04 按照教程客户端访问不了 报错list index out of range 浏览器可以访问

没有解决,是他服务监听的问题,而且服务并没有提供相应的参数配置监听

@MRXLT
Copy link
Contributor

MRXLT commented Sep 8, 2020

不好意思,这个问题我们会尽快修复,可以先通过修改 $PYTHONROOT/lib/python3.6/site-packages/paddle_gpu_serving/run/init.py中的监听地址实现跨机器访问
image

@bigpo
Copy link

bigpo commented Nov 17, 2020

不好意思,这个问题我们会尽快修复,可以先通过修改 $PYTHONROOT/lib/python3.6/site-packages/paddle_gpu_serving/run/init.py中的监听地址实现跨机器访问
image

请问现在修复了吗?现在还是会遇到list index out of range的错误

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

No branches or pull requests

7 participants