mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-22 14:13:08 -05:00
[PR #8328] [CLOSED] fix: mps detected in env.py #9000
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/8328
Author: @richtong
Created: 1/5/2025
Status: ❌ Closed
Base:
dev← Head:rich-mps-dev📝 Commits (1)
3b3b389fix: mps detected in env.py📊 Changes
1 file changed (+23 additions, -23 deletions)
View changed files
📝
backend/open_webui/env.py(+23 -23)📄 Description
Detects in env.py if apple silicon can be used and sets pytorch to it (and sorry my linter added some other commas and reformatting, I can fix if needed and disable that).
The changes are:
Note: I do not have a Windows machine nor a CUDA machine, but looking at the code it should perform the same in setting env.py properly
Note: I did not fix but can if desired fixed two other places where there code looks wrong. I just grepped for "coda". I'm not sure why they ignore the logic in env.py which basically ignores CUDA in Docker unless DOCKER_CUDA is set
./backend/open_webui/routes/audio.py:99 This is setting device type but only allows cuda and cpu but not mps. I don't know the audio code well enough to know why it is overriding what is set in ./env.py
./backend/open_webui/retrieval/models/colbert.py:11 this is ignoring DEVICE_TYPE. Again, I didn't change it because I don't know the Colbert code well enough. Does if fail on Apple Silicon. Is this because RAG does not have access to env.py, I don't know the code well enough to say
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
Added. Check for Apple Silicon and the pytorch mps device
Added. README on how to use uv in a venv to debug the backend
Changed
Changed. Detection in env.py of docker, cuda and cpu only so mps is added easily
Deprecated
None
Removed
None
Fixed
None
Security
None
Breaking Changes
None
Additional Information
The current implementation runs sentence transformers in RAG on CPU only when Apple Silicon support is available
Screenshots or Videos
Hard to capture the speed increases, but this speeds up RAG by 100x at least on my M4 Max. I can also see the GPU is being used in the Stats.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.