[PR #5396] [CLOSED] fix: CUDA unavailable but USE_CUDA_DOCKER=true should crash #21677

Closed
opened 2026-04-20 03:38:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/5396
Author: @thiswillbeyourgithub
Created: 9/13/2024
Status: Closed

Base: devHead: fix_cuda_not_checked


📝 Commits (10+)

  • 77673b6 fix: USE_CUDA_DOCKER true without gpu should crash
  • 6efbd3f fix: change metadata to metadatas
  • 932174c fix: log exception when issues of collection querying
  • 73adc61 enh: use non hybrid search as fallback if hybrid search failed
  • 3457d75 fix: much improved RAG template
  • 42793f7 logs: crash if rag_template would be wrong
  • 11c182e fix: handle case where [query] happens in the RAG context
  • e26893d fix: add check that the context for RAG is not empty if the threshold is 0
  • a8a94ee log: added a debug log if detecting a potential prompt injection attack
  • 3723189 added a few type hints

📊 Changes

53 files changed (+672 additions, -95 deletions)

View changed files

📝 backend/open_webui/__init__.py (+12 -0)
📝 backend/open_webui/apps/images/main.py (+40 -0)
📝 backend/open_webui/apps/rag/utils.py (+63 -26)
📝 backend/open_webui/apps/rag/vector/dbs/chroma.py (+21 -12)
📝 backend/open_webui/apps/rag/vector/dbs/milvus.py (+44 -12)
📝 backend/open_webui/apps/rag/vector/main.py (+5 -2)
📝 backend/open_webui/apps/webui/routers/models.py (+12 -20)
📝 backend/open_webui/config.py (+84 -10)
📝 backend/open_webui/main.py (+9 -0)
📝 src/app.html (+16 -13)
📝 src/lib/components/admin/Settings/Images.svelte (+97 -0)
📝 src/lib/components/chat/Settings/General.svelte (+23 -0)
📝 src/lib/i18n/locales/ar-BH/translation.json (+6 -0)
📝 src/lib/i18n/locales/bg-BG/translation.json (+6 -0)
📝 src/lib/i18n/locales/bn-BD/translation.json (+6 -0)
📝 src/lib/i18n/locales/ca-ES/translation.json (+6 -0)
📝 src/lib/i18n/locales/ceb-PH/translation.json (+6 -0)
📝 src/lib/i18n/locales/de-DE/translation.json (+6 -0)
📝 src/lib/i18n/locales/dg-DG/translation.json (+6 -0)
📝 src/lib/i18n/locales/en-GB/translation.json (+6 -0)

...and 33 more files

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • [ X ] Target branch: Please verify that the pull request targets the dev branch.
  • [ X ] Description: Provide a concise description of the changes made in this pull request.
  • [ X ] Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • [ X ] Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • [ X ] Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • [ X ] Testing: Have you written and run sufficient tests for validating the changes?
  • [ X ] Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • [ X ] Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • If the user set the env var USE_CUDA_DOCKER variable to true and (for one reason or another) cuda is not available: Open-WebUI should check that cuda is indeed available.

Added

  • Add check to crash if torch.cuda.is_available() is False even though USE_CUDA_DOCKER is "true"

Additional Information

Related to the issue that caused #5378 in my case. My CUDA was not available for reasons unrelated to Open-WebUI but no check whatsoever was done until something tried to use cuda. In my case it was the hybrid search.

@tjbck I think this too illustrates that Open-WebUI does not have appropriate checks. IMO, asserts are cheap and will save everyone a lot of headache.

If you you think you're spread too thin over this project and that makes it hard to pay attention to everything in your code then I say all the more reason to use modern coding practices. It's a time saver, not a time drain. In practice: use asserts more, display errors to admins, add optional typechecking. But never forget to take care of yourself :). If I may offer an unsolicited piece of advice, click me.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/5396 **Author:** [@thiswillbeyourgithub](https://github.com/thiswillbeyourgithub) **Created:** 9/13/2024 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix_cuda_not_checked` --- ### 📝 Commits (10+) - [`77673b6`](https://github.com/open-webui/open-webui/commit/77673b674ccccbd3ed1b086900dd356dd74eac87) fix: USE_CUDA_DOCKER true without gpu should crash - [`6efbd3f`](https://github.com/open-webui/open-webui/commit/6efbd3f42711f6d1169c3269987c3814fbd92b09) fix: change metadata to metadatas - [`932174c`](https://github.com/open-webui/open-webui/commit/932174c0c54dcfbc5ecb00d1a0dd2729bc9c02be) fix: log exception when issues of collection querying - [`73adc61`](https://github.com/open-webui/open-webui/commit/73adc6101389f52d27736596ec75ba5d80392695) enh: use non hybrid search as fallback if hybrid search failed - [`3457d75`](https://github.com/open-webui/open-webui/commit/3457d7561af1feb811dc0b3b5cc9681436949f32) fix: much improved RAG template - [`42793f7`](https://github.com/open-webui/open-webui/commit/42793f70cf80f4a6ac51633f806a778dd2da1ff4) logs: crash if rag_template would be wrong - [`11c182e`](https://github.com/open-webui/open-webui/commit/11c182e602d5bbafbb39e23ad80f83d4cd864e5a) fix: handle case where [query] happens in the RAG context - [`e26893d`](https://github.com/open-webui/open-webui/commit/e26893de77143550f72aca38cdc8eed1ad3f67ba) fix: add check that the context for RAG is not empty if the threshold is 0 - [`a8a94ee`](https://github.com/open-webui/open-webui/commit/a8a94ee5e7f2291d128a1c4caa8ee196e7e96ad9) log: added a debug log if detecting a potential prompt injection attack - [`3723189`](https://github.com/open-webui/open-webui/commit/37231892b64317b76c3e9e6a2db1fcd5c224b2f1) added a few type hints ### 📊 Changes **53 files changed** (+672 additions, -95 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/__init__.py` (+12 -0) 📝 `backend/open_webui/apps/images/main.py` (+40 -0) 📝 `backend/open_webui/apps/rag/utils.py` (+63 -26) 📝 `backend/open_webui/apps/rag/vector/dbs/chroma.py` (+21 -12) 📝 `backend/open_webui/apps/rag/vector/dbs/milvus.py` (+44 -12) 📝 `backend/open_webui/apps/rag/vector/main.py` (+5 -2) 📝 `backend/open_webui/apps/webui/routers/models.py` (+12 -20) 📝 `backend/open_webui/config.py` (+84 -10) 📝 `backend/open_webui/main.py` (+9 -0) 📝 `src/app.html` (+16 -13) 📝 `src/lib/components/admin/Settings/Images.svelte` (+97 -0) 📝 `src/lib/components/chat/Settings/General.svelte` (+23 -0) 📝 `src/lib/i18n/locales/ar-BH/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/bg-BG/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/bn-BD/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/ca-ES/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/ceb-PH/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/de-DE/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/dg-DG/translation.json` (+6 -0) 📝 `src/lib/i18n/locales/en-GB/translation.json` (+6 -0) _...and 33 more files_ </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [ X ] **Target branch:** Please verify that the pull request targets the `dev` branch. - [ X ] **Description:** Provide a concise description of the changes made in this pull request. - [ X ] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ X ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [ X ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [ X ] **Testing:** Have you written and run sufficient tests for validating the changes? - [ X ] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [ X ] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - If the user set the env var `USE_CUDA_DOCKER` variable to `true` and (for one reason or another) cuda is not available: Open-WebUI should check that cuda is indeed available. ### Added - Add check to crash if torch.cuda.is_available() is False even though USE_CUDA_DOCKER is "true" --- ### Additional Information Related to the issue that caused #5378 in my case. My CUDA was not available for reasons unrelated to Open-WebUI but no check whatsoever was done until something tried to use cuda. In my case it was the hybrid search. @tjbck I think this too illustrates that Open-WebUI does not have appropriate checks. IMO, asserts are cheap and will save everyone a lot of headache. <details> If you you think you're spread too thin over this project and that makes it hard to pay attention to everything in your code then I say all the more reason to use modern coding practices. It's a time saver, not a time drain. In practice: use asserts more, display errors to admins, add optional typechecking. But never forget to take care of yourself :). <summary> If I may offer an unsolicited piece of advice, click me. </summary> </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 03:38:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#21677