mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-22 14:13:08 -05:00
[PR #8366] [CLOSED] fix: apple silicon test fails so import pytorch before test and log exception if test fails #9005
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/8366
Author: @richtong
Created: 1/6/2025
Status: ❌ Closed
Base:
main← Head:rich-mps📝 Commits (1)
6f0f909fix: apple silicon import pytorch and debug📊 Changes
1 file changed (+3 additions, -2 deletions)
View changed files
📝
backend/open_webui/env.py(+3 -2)📄 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:
devbranch.Changelog Entry
Description
Added
Changed
Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
The current test is, but torch is not imported (this only happens if USE_CUDA=true, there is no top level import. The test fails because torch is not loaded and since the exceptions are ignored, DEVICE_TYPE="cpu" is left as it is and the user gets no explanation
The fix (although ugly) is to import torch in the try loop and also to print the actual
exception (it looks like logging is not used in this part of the code and print to stdout)
is what happens
This was raised in https://github.com/open-webui/open-webui/discussions/8278 and was raised in https://github.com/open-webui/open-webui/issues/8324 and PR issued in https://github.com/open-webui/open-webui/pull/8328 but the commit
d477f73c7ewas applied instead which is correct except import torch is not in the try and the errors are ignored.Screenshots or Videos
N/A
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.