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

Local embedding model cannot be used #12464

Closed
5 tasks done
opsvr202 opened this issue Jan 8, 2025 · 6 comments
Closed
5 tasks done

Local embedding model cannot be used #12464

opsvr202 opened this issue Jan 8, 2025 · 6 comments
Assignees
Labels
🐞 bug Something isn't working

Comments

@opsvr202
Copy link

opsvr202 commented Jan 8, 2025

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.15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Purely intranet environment, the steps are as follows:

1、Enter the knowledge base;
2、Create a knowledge base;
3、Choose between the general mode and the parent-child mode;
4、Upload documents;
5、An error is reported during vector processing;

The error content is as follows:

HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retroes exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fa5469b7500>: Failed to resolve 'openaipublic.blob.core.windows.net' ([Error -2] Name or service not know)"))

✔️ Expected Behavior

When the intranet environment cannot access the Internet, a locally deployed model can be used to embed the knowledge base

❌ Actual Behavior

When the intranet environment implements knowledge base embedding, the service will access the extranet, resulting in the inability to use privatized deployment

@dosubot dosubot bot added 🐞 bug Something isn't working 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. labels Jan 8, 2025
Copy link

dosubot bot commented Jan 8, 2025

I found a similar unsolved discussion regarding a NameResolutionError when trying to resolve 'openaipublic.blob.core.windows.net' in a self-hosted Dify environment [1]. This issue seems related to network configuration and accessing external resources in an intranet-only setup.

To address the problem of using local embedding models in a self-hosted Dify environment without internet access, you can configure a local embedding model using either Xinference or LocalAI. Here are the steps for LocalAI:

  1. Clone the LocalAI repository:

    $ git clone https://github.com/go-skynet/LocalAI
    $ cd LocalAI/examples/langchain-chroma
  2. Download example LLM and Embedding models:

    $ wget https://huggingface.co/skeskinen/ggml/resolve/main/all-MiniLM-L6-v2/ggml-model-q4_0.bin -O models/bert
    $ wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j
  3. Configure the .env file:

    $ mv .env.example .env
  4. Start LocalAI:

    $ docker-compose up -d --build
    $ docker logs -f langchain-chroma-api-1
  5. Integrate the models into Dify:

    • Go to Settings > Model Providers > LocalAI and fill in the details for each model:
      • Model 1: ggml-gpt4all-j
        • Model Type: Text Generation
        • Model Name: gpt-3.5-turbo
        • Server URL: http://127.0.0.1:8080
      • Model 2: all-MiniLM-L6-v2
        • Model Type: Embeddings
        • Model Name: text-embedding-ada-002
        • Server URL: http://127.0.0.1:8080

Ensure that the Dify container can access the LocalAI endpoint by using the appropriate host IP address. This setup should allow you to use local models for embedding without needing internet access [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@opsvr202
Copy link
Author

opsvr202 commented Jan 8, 2025

The model provider docks with xinference, which includes embedded models. Similar problems occurred when dify first supported the call of locally deployed model functions to go online. They were subsequently resolved. I wonder if this time's occurrence is related to the new online knowledge base support for parent-child mode

@crazywoola
Copy link
Member

Duplicated, I saw this error message lots of times.

HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retroes exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fa5469b7500>: Failed to resolve 'openaipublic.blob.core.windows.net' ([Error -2] Name or service not know)"))

This is a general network issue, you seems to call OpenAI service which you might not intend to, please check the system provider settings, QA and P-C will use system models for reasoning.

@opsvr202
Copy link
Author

opsvr202 commented Jan 8, 2025

2ca4fdbce1439ebe4131f163e68a72d
The model provider selected the correct one, but v0.14.2 did not have this problem and was used normally. This problem occurred when upgrading to v0.15.0.

@crazywoola crazywoola reopened this Jan 8, 2025
@crazywoola crazywoola removed the 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. label Jan 8, 2025
@crazywoola crazywoola assigned laipz8200 and unassigned JohnJyong Jan 8, 2025
@crazywoola
Copy link
Member

Seems related (#12416) @laipz8200

@crazywoola
Copy link
Member

#12471

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