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

[Bug] gradio does not recognize URLs and local paths properly #3102

Closed
3 tasks done
Lychee-acaca opened this issue Jan 29, 2025 · 1 comment
Closed
3 tasks done

[Bug] gradio does not recognize URLs and local paths properly #3102

Lychee-acaca opened this issue Jan 29, 2025 · 1 comment
Assignees

Comments

@Lychee-acaca
Copy link
Contributor

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.

Describe the bug

When starting the webui server through gradio, it misidentified the local path as a URL and failed to start.

Reproduction

lmdeploy serve gradio Qwen/Qwen2.5-0.5B-Instruct

Environment

sys.platform: win32
Python: 3.8.20 (default, Oct  3 2024, 15:19:54) [MSC v.1929 64 bit (AMD64)]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0: NVIDIA GeForce RTX 4060
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4
NVCC: Cuda compilation tools, release 12.4, V12.4.99
GCC: n/a
PyTorch: 2.4.1+cu124
PyTorch compiling details: PyTorch built with:
  - C++ Version: 201703
  - MSVC 192930154
  - Intel(R) oneAPI Math Kernel Library Version 2024.2.1-Product Build 20240722 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v3.4.2 (Git Hash 1137e04ec0b5251ca2b4400a4fd3c667ce843d67)
  - OpenMP 2019
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: AVX512
  - CUDA Runtime 12.4
  - NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90
  - CuDNN 90.1
  - Magma 2.5.4
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.4, CUDNN_VERSION=9.1.0, CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /Zc:__cplusplus /bigobj /FS /utf-8 -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.4.1, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

TorchVision: 0.19.1+cu124
LMDeploy: 0.7.0.post2+aa8e797
transformers: 4.46.3
gradio: 4.44.1
fastapi: 0.115.7
pydantic: 2.10.6
triton: Not Found

Error traceback

Fetching 10 files: 100%|███████████████████████████████████████████████████████████████████████| 10/10 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "D:\miniconda3\envs\lmdeploy\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\miniconda3\envs\lmdeploy\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\miniconda3\envs\lmdeploy\Scripts\lmdeploy.exe\__main__.py", line 7, in <module>
    sys.exit(run())
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\lmdeploy\cli\entrypoint.py", line 39, in run
    args.run(args)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\lmdeploy\cli\serve.py", line 247, in gradio
    run(args.model_path_or_server,
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\lmdeploy\serve\gradio\app.py", line 42, in run
    run_api_server(model_path_or_server, server_name, server_port, batch_size, share=share)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\lmdeploy\serve\gradio\api_server_backend.py", line 132, in run_api_server
    model_names = get_model_list(f'{api_server_url}/v1/models')
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\lmdeploy\serve\openai\api_client.py", line 12, in get_model_list
    response = requests.get(api_url, headers=headers)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\requests\sessions.py", line 697, in send
    adapter = self.get_adapter(url=request.url)
  File "D:\miniconda3\envs\lmdeploy\lib\site-packages\requests\sessions.py", line 792, in get_adapter
    raise InvalidSchema(f"No connection adapters were found for {url!r}")
requests.exceptions.InvalidSchema: No connection adapters were found for 'D:\\huggingface\\hub\\models--Qwen--Qwen2.5-0.5B-Instruct\\snapshots\\7ae557604adf67be50417f59c2c2f167def9a775/v1/models'
@Lychee-acaca
Copy link
Contributor Author

This problem only occurs on Windows, the path of the model is D:\\huggingface\\hub\\models--Qwen--Qwen2.5-0.5B-Instruct\\snapshots\\7ae557604adf67be50417f59c2c2f167def9a775/v1/models.
At line 40 of app.py:

if ':' in model_path_or_server:
    from lmdeploy.serve.gradio.api_server_backend import run_api_server
    run_api_server(model_path_or_server, server_name, server_port, batch_size, share=share)
else:
    pipeline_type, _ = get_task(model_path_or_server)

The program uses colons to determine whether the input is a URL, so D: is recognized as a URL, and initiated a request to this local path incorrectly.

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

3 participants