Xinference failed to access the local model #5005

Closed
opened 2026-02-21 18:08:59 -05:00 by yindo · 1 comment
Owner

Originally created by @njzfw1024 on GitHub (Aug 12, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Xinference credentials validate failed: get xinference model extra parameter failed, url: http://219.84.190.172:7855/v1/models/qw72Blora, error: HTTPConnectionPool(host='219.84.190.172', port=7855): Max retries exceeded with url: /v1/models/qw72Blora (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f2f9f1f6a40>, 'Connection to219.84.190.172 timed out. (connect timeout=10)'))

remarks: I ensure that xinference local -- host 0.0.0.0

✔️ Expected Behavior

success to access the local model

Actual Behavior

failed to access the local model

Originally created by @njzfw1024 on GitHub (Aug 12, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.16 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Xinference credentials validate failed: get xinference model extra parameter failed, url: http://219.84.190.172:7855/v1/models/qw72Blora, error: HTTPConnectionPool(host='219.84.190.172', port=7855): Max retries exceeded with url: /v1/models/qw72Blora (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f2f9f1f6a40>, 'Connection to219.84.190.172 timed out. (connect timeout=10)')) remarks: I ensure that xinference local -- host 0.0.0.0 ### ✔️ Expected Behavior success to access the local model ### ❌ Actual Behavior failed to access the local model
yindo added the 🐞 bug label 2026-02-21 18:08:59 -05:00
yindo closed this issue 2026-02-21 18:08:59 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 12, 2024):

Hey @njzfw1024! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. I'm a bot designed to assist you while waiting for a human maintainer. Let's squash those bugs together!

To resolve the connection timeout error when accessing a local model using Xinference on a self-hosted Docker setup with Dify version 0.6.16, ensure that the Dify container can access the Xinference endpoint. The Dify container cannot access localhost inside the container, so you need to use the host IP address.

Here are the steps to follow:

  1. Install Xinference:

    $ pip install "xinference[all]"
    
  2. Start Xinference with the correct host configuration:

    $ xinference-local -H 0.0.0.0
    

    This command allows access from any non-local client.

  3. Ensure the Dify container can access the Xinference endpoint:

    In the Dify settings, use the host machine's IP address instead of localhost or 127.0.0.1. For example, if your host machine's IP address is 192.168.1.100, configure the server URL in Dify as follows:

    Server URL: http://192.168.1.100:9997
    
  4. Deploy the model in Xinference:

    Access http://192.168.1.100:9997 in your browser, select the model you want to deploy, and note the model UID.

  5. Configure the model in Dify:

    In Settings > Model Providers > Xinference, enter the following details:

    • Model name: vicuna-v1.3
    • Server URL: http://192.168.1.100:9997 (Replace with your machine IP address)
    • Model UID: 2c886330-8849-11ee-9518-43b0b8f40bea

    Click "Save" to use the model in the Dify application.

Additionally, ensure that the Xinference model extra parameters are correctly fetched and cached. The XinferenceHelper class in Dify's codebase handles this by making HTTP requests to the Xinference server and caching the results. If you encounter issues, check the following:

  • The XinferenceHelper class uses a session with a retry mechanism to handle transient network issues.
  • The model parameters such as model_format, model_handle_type, model_ability, max_tokens, and context_length are fetched and cached for 300 seconds to reduce the load on the server.

By following these steps and ensuring the correct configuration, you should be able to resolve the connection timeout error [1][2][3][4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 12, 2024): <!-- Greeting --> Hey @njzfw1024! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. I'm a bot designed to assist you while waiting for a human maintainer. Let's squash those bugs together! <!-- Answer --> To resolve the connection timeout error when accessing a local model using Xinference on a self-hosted Docker setup with Dify version 0.6.16, ensure that the Dify container can access the Xinference endpoint. The Dify container cannot access `localhost` inside the container, so you need to use the host IP address. Here are the steps to follow: 1. **Install Xinference:** ```bash $ pip install "xinference[all]" ``` 2. **Start Xinference with the correct host configuration:** ```bash $ xinference-local -H 0.0.0.0 ``` This command allows access from any non-local client. 3. **Ensure the Dify container can access the Xinference endpoint:** In the Dify settings, use the host machine's IP address instead of `localhost` or `127.0.0.1`. For example, if your host machine's IP address is `192.168.1.100`, configure the server URL in Dify as follows: ```plaintext Server URL: http://192.168.1.100:9997 ``` 4. **Deploy the model in Xinference:** Access `http://192.168.1.100:9997` in your browser, select the model you want to deploy, and note the model UID. 5. **Configure the model in Dify:** In `Settings > Model Providers > Xinference`, enter the following details: - Model name: `vicuna-v1.3` - Server URL: `http://192.168.1.100:9997` (Replace with your machine IP address) - Model UID: `2c886330-8849-11ee-9518-43b0b8f40bea` Click "Save" to use the model in the Dify application. Additionally, ensure that the Xinference model extra parameters are correctly fetched and cached. The `XinferenceHelper` class in Dify's codebase handles this by making HTTP requests to the Xinference server and caching the results. If you encounter issues, check the following: - The `XinferenceHelper` class uses a session with a retry mechanism to handle transient network issues. - The model parameters such as `model_format`, `model_handle_type`, `model_ability`, `max_tokens`, and `context_length` are fetched and cached for 300 seconds to reduce the load on the server. By following these steps and ensuring the correct configuration, you should be able to resolve the connection timeout error <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/model-configuration/xinference.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/model-configuration/xinference.md)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/model-configuration/xinference.md)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/xinference/xinference_helper.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5005