-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Dify with OIlama keeps restarting #8536
Comments
Hey @dougpiv! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify with OIlama! I'm an expert bot and I'll assist you while we wait for a human maintainer to jump in. I found a similar discussion regarding the Ollama model restarting at each iteration in Dify version 8.2. The issue is due to a connection problem between Docker containers and the Ollama service. The Docker container cannot access the Ollama service using http://host.docker.internal:11434 This change ensures that the Docker container can correctly access the Ollama service, preventing the model from restarting at each iteration. Additionally, if you are deploying Dify and Ollama using Docker, consider using the local network IP address, e.g., For more details, you can refer to the discussion on this issue [3]. |
I am already using host.docker.internal and the connection is working. What is happening is that it seems to be restarting the model on the GPU with every request in a cycle in Dify. |
The model on the GPU is likely restarting with every request in a cycle because the Ollama service is not properly exposed to the network. Ensure that the Ollama service is accessible from the Docker container by setting the For macOS: launchctl setenv OLLAMA_HOST "0.0.0.0" For Linux: [Service]
Environment="OLLAMA_HOST=0.0.0.0" For Windows:
Additionally, if you are deploying Dify using Docker, use the local network IP address or the Docker host machine's IP address instead of http://192.168.1.100:11434 or http://172.17.0.1:11434 Ensure that the Dify container can access the endpoint of Xinference if you are using it for local model deployment. Replace http://<Machine_IP>:9997 Start Xinference with the xinference-local -H 0.0.0.0 Finally, ensure that the DIFY_BIND_ADDRESS: ${DIFY_BIND_ADDRESS:-0.0.0.0} This configuration should prevent the model from restarting with every request [1][2][3][4]. |
Self Checks
Dify version
8.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I am experiencing a strange behavior when I run the workflow in Dify. It makes the call to Ollama, but it is restarting the model at each iteration. It didn’t do this in the previous version 7.3. The model is llama3.1.
✔️ Expected Behavior
I expect that the memory on gpu keeps full and dont restart de model every iteration
❌ Actual Behavior
Every iteration the model restarts on ollama
The text was updated successfully, but these errors were encountered: