pinferencia
pinferencia copied to clipboard
请问如何修改端口?
8000被占用了,文档没有看到哪里可以修改端口,请问如何修改端口?
Hi, 你好,
Pinfer 命令
如果使用 pinfer 命令启动服务,可以通过 --backend-port 参数修改端口
如:
pinfer app:service --backend-port 8080
要想查看该命令的所有参数,可以执行
pinfer --help
或者访问 CLI 的文档页面 CLI
Uvicorn 命令
如果使用 uvicorn 启动服务,可以通过 --port 参数修改端口
如:
uvicorn app:service --port 8080
要想查看该命令的所有参数,可以执行
uvicorn --help
关于你提出的文档没有找到的问题。对于常见的问题,我想我们后面加一个 FAQ 的页面会比较好,我会后续把这部分补充好。
I could access the document on http://127.0.0.1:8000, but could not access the GUI from web browser on http://127.0.0.1:8501, as described.
When "pinfer app:service", I could see Pinferencia: Frontend component streamlit is starting... Pinferencia: streamlit address will be shown once it has started
Pinferencia: Backend component uvicorn is starting... Pinferencia: uvicorn address will be shown once it has started
But a few seconds later, I only saw Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) Never get streamlit address back.
Did I miss anything?
I could access the document on http://127.0.0.1:8000, but could not access the GUI from web browser on http://127.0.0.1:8501, as described.
When "pinfer app:service", I could see Pinferencia: Frontend component streamlit is starting... Pinferencia: streamlit address will be shown once it has started
Pinferencia: Backend component uvicorn is starting... Pinferencia: uvicorn address will be shown once it has started
But a few seconds later, I only saw Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) Never get streamlit address back.
Did I miss anything?
Hi, @jeffrover
Would you mind sharing your installed version of pinferencia and streamlit?
You can get the result with
pip freeze | grep pinferencia
pip freeze | grep streamlit
And I would like to confirm, the below messages are not shown in your console?
@jeffrover Also, can you try to run the following script with streamlit
to check if there are any error messages?
Save the following file to your computer:
https://github.com/underneathall/pinferencia/blob/main/examples/custom_frontend/frontend.py
Run the following command and check the output
streamlit run frontend.py
pinferencia 0.2.1 streamlit 1.13.0 You're right, the red box wasn't showing. When I tried "streamlit run frontend.py", firefox browser loaded "My awesome model" page, backend wasn't load, I supposed that's ok for this test. The URL is localhost:8051, which was prompt on my terminal.
pinferencia 0.2.1 streamlit 1.13.0 You're right, the red box wasn't showing. When I tried "streamlit run frontend.py", firefox browser loaded "My awesome model" page, backend wasn't load, I supposed that's ok for this test. The URL is localhost:8051, which was prompt on my terminal.
Thanks for the reply, @jeffrover.
Some extra help
Environment
I will need some extra information to try to reproduce the case, please kindly provide the following information:
- Operating system and its version
- Python Version
- A full
pip freeze
output if possible
Some debug help
At the meantime, if you have time, can you try the following command to see if it also fails to start the streamlit server?
1. Run the frontend-only mode
pinfer --mode=frontend http://127.0.0.1:8000
2. Run the frontend with custom script
https://github.com/underneathall/pinferencia/blob/main/examples/custom_frontend/frontend.py
pinfer --mode=frontend http://127.0.0.1:8000 --frontend-script=frontend.py
Temporary fix
I'm sorry about the trouble you met. As a temporary fix, you can save the following codes as default.py
,
from pinferencia.frontend.app import Server
service = Server(backend_server="http://127.0.0.1:8000")
And manually start the frontend server
streamlit run default.py
And the backend server:
pinfer --mode=backend app:service
Then you should be able to use the frontend properly.
I'll try to reproduce the problem and locate the cause asap.
@wjiuhe , Thank you for the quick reply and details. I'm using CentOS 7, python 3.8.2 pkg.txt
I tried the two pinfer (of explicit frontend), both worked. I tried your temp fix, it also worked. I'll just continue my exploring with it. By the way, I like the minimalistic design style of pinferencia!
Thank you, @jeffrover.
I may need some time to reproduce the problem using your environment setting.
This problem might be due to something wrong in python multiprocessing per environment. Pinferencia
uses a separate process to start the frontend with the default
mode. This explains why starting with the frontend
mode is working.
Hi, @jeffrover.
As I don't have a CentOS machine, I use the CentOS docker image to set up the environment. However, I'm having trouble reproducing the problem.
I suspect there are some conflicts causing python multiprocessing module not working properly.
If you have time, can you help try the example on the Python Official site to ensure the multiprocessing module is normal?
Example
Save the codes below as test.py
and run python test.py
.
from multiprocessing import Process
def f(name):
print('hello', name)
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
p.join()
Check if "hello bob" appears in the console output.
Python Image as the Environment
Meanwhile, you can try to use a Python Docker image as the environment to try out pinferencia.
For example:
docker pull python:3.10-buster
docker run -it python:3.10-buster bash
then
pip install "pinferencia[streamlit]"