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

docker环境下进行命令行训练,如果无可用端口时gradio的导入会失败 #3317

Closed
1 task done
onebula opened this issue Apr 17, 2024 · 3 comments
Closed
1 task done
Labels
solved This problem has been already solved

Comments

@onebula
Copy link

onebula commented Apr 17, 2024

Reminder

  • I have read the README and searched the existing issues.

Reproduction

[2024-04-17 18:33:08,604] [INFO] [real_accelerator.py:191:get_accelerator] Setting ds_accelerator to cuda (auto detect)
[2024-04-17 18:33:08,725] [INFO] [real_accelerator.py:191:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Traceback (most recent call last):
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urlparse.py", line 346, in normalize_port
port_as_int = int(port)
ValueError: invalid literal for int() with base 10: ':'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/train_bash.py", line 1, in
from llmtuner import run_exp
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/llmtuner/init.py", line 7, in
from .webui import create_ui, create_web_demo
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/llmtuner/webui/init.py", line 1, in
from .interface import create_ui, create_web_demo
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/llmtuner/webui/interface.py", line 1, in
import gradio as gr
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/init.py", line 3, in
import gradio._simple_templates
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/_simple_templates/init.py", line 1, in
from .simpledropdown import SimpleDropdown
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/_simple_templates/simpledropdown.py", line 6, in
from gradio.components.base import FormComponent
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/components/init.py", line 1, in
from gradio.components.annotated_image import AnnotatedImage
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/components/annotated_image.py", line 13, in
from gradio import processing_utils, utils
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/processing_utils.py", line 30, in
async_client = httpx.AsyncClient()
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_client.py", line 1442, in init
self._mounts: dict[URLPattern, AsyncBaseTransport | None] = {
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_client.py", line 1443, in
URLPattern(key): None
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_utils.py", line 370, in init
url = URL(pattern)
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urls.py", line 115, in init
self._uri_reference = urlparse(url, **kwargs)
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urlparse.py", line 248, in urlparse
parsed_port: int | None = normalize_port(port, scheme)
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urlparse.py", line 348, in normalize_port
raise InvalidURL(f"Invalid port: {port!r}")
httpx.InvalidURL: Invalid port: ':'
Traceback (most recent call last):
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urlparse.py", line 346, in normalize_port
port_as_int = int(port)
ValueError: invalid literal for int() with base 10: ':'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/train_bash.py", line 1, in
from llmtuner import run_exp
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/llmtuner/init.py", line 7, in
from .webui import create_ui, create_web_demo
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/llmtuner/webui/init.py", line 1, in
from .interface import create_ui, create_web_demo
File "/mlx/users/chenkuang.1/repo/2633/train_llm/lib/LLaMA-Factory/src/llmtuner/webui/interface.py", line 1, in
import gradio as gr
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/init.py", line 3, in
import gradio._simple_templates
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/_simple_templates/init.py", line 1, in
from .simpledropdown import SimpleDropdown
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/_simple_templates/simpledropdown.py", line 6, in
from gradio.components.base import FormComponent
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/components/init.py", line 1, in
from gradio.components.annotated_image import AnnotatedImage
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/components/annotated_image.py", line 13, in
from gradio import processing_utils, utils
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/gradio/processing_utils.py", line 30, in
async_client = httpx.AsyncClient()
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_client.py", line 1442, in init
self._mounts: dict[URLPattern, AsyncBaseTransport | None] = {
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_client.py", line 1443, in
URLPattern(key): None
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_utils.py", line 370, in init
url = URL(pattern)
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urls.py", line 115, in init
self._uri_reference = urlparse(url, **kwargs)
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urlparse.py", line 248, in urlparse
parsed_port: int | None = normalize_port(port, scheme)
File "/home/tiger/.pyenv/versions/3.10.14/envs/train_llm/lib/python3.10/site-packages/httpx/_urlparse.py", line 348, in normalize_port
raise InvalidURL(f"Invalid port: {port!r}")
httpx.InvalidURL: Invalid port: ':'
[2024-04-17 18:33:11,418] [INFO] [launch.py:316:sigkill_handler] Killing subprocess 20087
[2024-04-17 18:33:11,419] [INFO] [launch.py:316:sigkill_handler] Killing subprocess 20088

Expected behavior

No response

System Info

No response

Others

建议命令行运行时llmtuner不用导入webui模块

@hiyouga
Copy link
Owner

hiyouga commented Apr 17, 2024

已修复,卸载 gradio 即可

@hiyouga hiyouga added the solved This problem has been already solved label Apr 17, 2024
@onebula
Copy link
Author

onebula commented Apr 17, 2024

已修复,卸载 gradio 即可

现在gradio还是作为requirements.txt里的一项会默认安装,是不是setup.py里拆分一下不同用途的安装列表好一些?

@htZhang25
Copy link

htZhang25 commented Oct 12, 2024

you can also change "/usr/local/lib/python3.9/dist-packages/httpx/_urlparse.py"
Line360:
if port is None or port == "":
to following
if port is None or port == "" or port[1:] is None or port[1:] == "":
For me ,it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved This problem has been already solved
Projects
None yet
Development

No branches or pull requests

3 participants