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容器启动程序后无法访问 #346

Open
monkeyGeek369 opened this issue Jul 6, 2024 · 14 comments
Open

docker容器启动程序后无法访问 #346

monkeyGeek369 opened this issue Jul 6, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@monkeyGeek369
Copy link

通过docker成功启动程序,也开启了webui,但是奇怪的是容器内可以访问127.0.0.1:7860但是宿主机无法访问。
1、已经做了端口映射,无效
2、容器采用host模式,无效
3、容器内可以ping通宿主机,但宿主机无法ping通容器ip
4、容器内可以访问页面

微信截图_20240706200743
微信截图_20240706200813
微信截图_20240706201035

@monkeyGeek369 monkeyGeek369 added the bug Something isn't working label Jul 6, 2024
@monkeyGeek369
Copy link
Author

求大恨帮忙,到底什么原因?

@monkeyGeek369
Copy link
Author

起了两个容器,无论是端口映射还是host网络都是一样的

docker run -p 7860:7860 --name fish-speech-myself -v E:\gitProject\fish-speech:/exp -d --gpus all fish-speech-fish-speech tail -f /dev/null

docker run --network host --name fish-speech-myself -v E:\gitProject\fish-speech:/exp -d --gpus all fish-speech-fish-speech tail -f /dev/null

@AnyaCoder
Copy link
Collaborator

在命令行里输入

netstat -ano | findstr :7860

看看是否有占用。

@fallbernana123456
Copy link

fallbernana123456 commented Jul 8, 2024

https://speech.fish.audio/inference/#webui 这个问题跟gradio相关,要使用demo.launch(..., server_name="0.0.0.0")
或者设置环境变量GRADIO_SERVER_NAME="0.0.0.0"

@chaoqunxie
Copy link

https://speech.fish.audio/inference/#webui 这个问题跟gradio相关,要使用demo.launch(..., server_name="0.0.0.0") 或者设置环境变量GRADIO_SERVER_NAME="0.0.0.0"

这是正确的 但是我启动推理页面总是说端口占用 但是实际上端口并没有被使用 2024-07-17 06:05:50.748 | INFO | tools.llama.generate:generate_long:509 - Generating sentence 1/1 of sample 1/1
0%| | 0/2015 [00:00<?, ?it/s]/usr/local/lib/python3.10/site-packages/torch/backends/cuda/init.py:342: FutureWarning: torch.backends.cuda.sdp_kernel() is deprecated. In the future, this context manager will be removed. Please see, torch.nn.attention.sdpa_kernel() for the new context manager, with updated signature.
warnings.warn(
0%| | 0/2015 [00:29<?, ?it/s]
2024-07-17 06:06:20.701 | INFO | main::507 - Warming up done, launching the web UI...
Traceback (most recent call last):
File "/exp/tools/webui.py", line 510, in
app.launch(show_api=True)
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2326, in launch
) = http_server.start_server(
File "/usr/local/lib/python3.10/site-packages/gradio/http_server.py", line 154, in start_server
raise OSError(
OSError: Cannot find empty port in range: 10001-10100. You can specify a different port by setting the GRADIO_SERVER_PORT environment variable or passing the server_port parameter to launch().

@chaoqunxie
Copy link

image

@AnyaCoder
Copy link
Collaborator

0.0.0.0

@chaoqunxie
Copy link

0.0.0.0

感谢! 手滑输错了~

@chaoqunxie
Copy link

chaoqunxie commented Jul 17, 2024

起了两个容器,无论是端口映射还是host网络都是一样的

docker run -p 7860:7860 --name fish-speech-myself -v E:\gitProject\fish-speech:/exp -d --gpus all fish-speech-fish-speech tail -f /dev/null

docker run --network host --name fish-speech-myself -v E:\gitProject\fish-speech:/exp -d --gpus all fish-speech-fish-speech tail -f /dev/null

#!/bin/bash
# 设置字符编码
export LC_ALL=en_US.UTF-8

# 设置初始变量
USE_MIRROR=true

PYTHON_CMD=python
API_FLAG_PATH=$(dirname "$0")/API_FLAGS.txt

# 设置默认的端点
HF_ENDPOINT="https://huggingface.co"
no_proxy=""

# 如果指定了使用镜像,则设置镜像地址
if [ "$USE_MIRROR" == "true" ]; then
    HF_ENDPOINT="https://hf-mirror.com"
    no_proxy="localhost, 127.0.0.1, 0.0.0.0"
fi

echo "HF_ENDPOINT: $HF_ENDPOINT"
echo "NO_PROXY: $no_proxy"

# 运行模型下载脚本
$PYTHON_CMD ./tools/download_models.py

# 初始化API标志
API_FLAGS=""
flags=""

# 如果存在API标志文件,则处理文件中的标志
if [ -f "$API_FLAG_PATH" ]; then
    while IFS= read -r line; do
        if [ "${line:0:1}" != "#" ]; then
            line=$(echo "$line" | sed 's/ /<SPACE>/g' | sed 's/\\//g' | sed 's/<SPACE>/ /g')
            if [ ! -z "$line" ]; then
                API_FLAGS="$API_FLAGS$line "
            fi
        fi
    done < "$API_FLAG_PATH"
fi

# 去除API_FLAGS末尾的空格
API_FLAGS=$(echo "$API_FLAGS" | sed 's/ *$//')

# 检查模式标志并相应地设置模式
echo "$API_FLAGS" | grep -q -- "--api"
if [ $? -eq 0 ]; then
    echo
    echo "启动HTTP API..."
    mode="api"
    process_flags
fi

echo "$API_FLAGS" | grep -q -- "--infer"
if [ $? -eq 0 ]; then
    echo
    echo "启动WebUI推理..."
    mode="infer"
    process_flags
fi

# 处理剩余标志
process_flags() {
    for p in $API_FLAGS; do
        if [ "$p" != "--$mode" ]; then
            flags="$flags $p"
        fi
    done
    flags=$(echo "$flags" | sed 's/^ *//')
}

# 输出调试信息
echo "调试: flags = $flags"

# 设置环境变量 GRADIO_SERVER_NAME
export GRADIO_SERVER_NAME="0.0.0.0"

# 运行相应模式
if [ "$mode" == "api" ]; then
    $PYTHON_CMD -m tools.api $flags
elif [ "$mode" == "infer" ]; then
    $PYTHON_CMD -m tools.webui $flags
fi

echo
echo "接下来启动页面..."
$PYTHON_CMD fish_speech/webui/manage.py

# 脚本结束                       用这个启动脚本

@chaoqunxie
Copy link

0.0.0.0

Open Labeler WebUI 这个好像打不开2024-07-17 06:51:58.924 | INFO | main::507 - Warming up done, launching the web UI...
2024-07-17 07:16:25.574 | WARNING | main:change_label:121 - asr-label execution not found!

@AnyaCoder
Copy link
Collaborator

AnyaCoder commented Jul 17, 2024

用在线版吧。这个要单独下载,解压后里面的文件放项目根目录下。
asr-label-linux-x64.zip.zip

@chaoqunxie
Copy link

用在线版吧。这个要单独下载,解压后里面的文件放项目根目录下。 asr-label-linux-x64.zip.zip

感谢大佬

@chaoqunxie
Copy link

用在线版吧。这个要单独下载,解压后里面的文件放项目根目录下。 asr-label-linux-x64.zip.zip

image
还是报错 2024-07-17 07:47:59.967 | WARNING | main:change_label:121 - asr-label execution not found!

@AnyaCoder
Copy link
Collaborator

可能是没有权限导致的, sudo chmod 777 asr-label-linux-x64.
不行的话用在线版,点击打标的时候会出现提示。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants