MACOS 26.2 M5芯片,32G内存
环境检测:
(deepseek-ocr-mlx) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % ./verify_mac_env.sh
======================================
🔍 Verifying Mac Environment
======================================
✅ Conda environment: deepseek-ocr-mlx
🐍 Python 3.11.14
📦 Checking required packages...
✅ torch (2.9.1)
✅ torchvision (0.24.1)
✅ transformers (4.46.3)
✅ tokenizers (0.20.3)
✅ fastapi (0.104.1)
✅ uvicorn (0.24.0)
✅ fitz (1.26.7)
✅ PIL (12.1.0)
✅ einops (0.8.1)
✅ addict (2.4.0)
✅ easydict (N/A)
✅ matplotlib (3.10.8)
✅ numpy (1.26.4)
🍎 Checking MPS (Metal Performance Shaders)...
✅ MPS is available
======================================
✅ Environment verification passed!
You can now run: ./start.sh
======================================
1、运行自动模式
没有自动下载Model,卡在sing conda environment: deepseek-ocr-mlx,内存占用13G、15G,即使开TUN、全局、退出代理,也是一样的
日志如下:
Last login: Thu Jan 15 10:55:57 on ttys002
(base) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % conda activate deepseek-ocr-mlx
(deepseek-ocr-mlx) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % ./start.sh
==========================================
🚀 DeepSeek-OCR-WebUI Startup
==========================================
🍎 Running on macOS
Apple Silicon detected
Selected backend: mps
==========================================
✅ Using conda environment: deepseek-ocr-mlx
2、加载本地模型运行: 还是卡在上一步
在Model Scope和Hf-mirror下载的模型都试过。
export LOCAL_MODEL_PATH=/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model
./start.sh
3、手动运行:
没有自动下载Model。
日志如下:
(deepseek-ocr-mlx) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % python web_service_unified.py
==================================================
🚀 DeepSeek-OCR Unified Service
==================================================
📍 URL: http://0.0.0.0:8001
📚 Docs: http://0.0.0.0:8001/docs
==================================================
INFO: Started server process [19594]
INFO: Waiting for application startup.
==================================================
🚀 DeepSeek-OCR Unified Service Starting...
==================================================
📁 Using local model: /Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model
✅ Detected Apple Silicon with MPS support
📦 Loading DeepSeek-OCR with MPS
You are using a model of type deepseek_vl_v2 to instantiate a model of type DeepseekOCR. This is not supported for all configurations of models and can yield errors.
Some weights of DeepseekOCRForCausalLM were not initialized from the model checkpoint at /Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model and are newly initialized: ['model.vision_model.embeddings.position_ids']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
✅ Model loaded on mps
✅ Backend loaded: MPS
==================================================
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO: 127.0.0.1:50883 - "GET / HTTP/1.1" 200 OK
/Users/jat/miniforge3/envs/deepseek-ocr-mlx/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:590: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.0` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.
warnings.warn(
The `seen_tokens` attribute is deprecated and will be removed in v4.41. Use the `cache_position` model input instead.
`get_max_cache()` is deprecated for all Cache classes. Use `get_max_cache_shape()` instead. Calling `get_max_cache()` will raise error from v4.48
=====================
BASE: torch.Size([1, 256, 1280])
PATCHES: torch.Size([6, 100, 1280])
=====================
The attention layers in this model are transitioning from computing the RoPE embeddings internally through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed `position_embeddings` (Tuple of tensors, containing cos and sin). In v4.46 `position_ids` will be removed and `position_embeddings` will be mandatory.
4、手动运行:提前修改本地Model位置再python web_service_unified.py
Model 是在Model Scope下载的:
modelscope download --model deepseek-ai/DeepSeek-OCR
内存溢出:

修改:web_service.py
# 全局变量
model = None
tokenizer = None
MODEL_PATH = '/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model'
MODEL_SOURCE = None # 记录实际使用的模型源
修改:web_service_unified.py
# Check for local model path
local_model_path = os.environ.get("/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model", "")
model_path = local_model_path if local_model_path else "deepseek-ai/DeepSeek-OCR"
日志如下:
(deepseek-ocr-mlx) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % python web_service_unified.py
==================================================
🚀 DeepSeek-OCR Unified Service
==================================================
📍 URL: http://0.0.0.0:8001
📚 Docs: http://0.0.0.0:8001/docs
==================================================
INFO: Started server process [9432]
INFO: Waiting for application startup.
==================================================
🚀 DeepSeek-OCR Unified Service Starting...
==================================================
✅ Detected Apple Silicon with MPS support
📦 Loading DeepSeek-OCR with MPS
You are using a model of type deepseek_vl_v2 to instantiate a model of type DeepseekOCR. This is not supported for all configurations of models and can yield errors.
Some weights of DeepseekOCRForCausalLM were not initialized from the model checkpoint at deepseek-ai/DeepSeek-OCR and are newly initialized: ['model.vision_model.embeddings.position_ids']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
✅ Model loaded on mps
✅ Backend loaded: MPS
==================================================
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO: 127.0.0.1:50245 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:50245 - "GET /favicon.ico HTTP/1.1" 404 Not Found
/Users/jat/miniforge3/envs/deepseek-ocr-mlx/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:590: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.0` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.
warnings.warn(
The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
Setting `pad_token_id` to `eos_token_id`:None for open-end generation.
The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
The `seen_tokens` attribute is deprecated and will be removed in v4.41. Use the `cache_position` model input instead.
`get_max_cache()` is deprecated for all Cache classes. Use `get_max_cache_shape()` instead. Calling `get_max_cache()` will raise error from v4.48
=====================
BASE: torch.Size([1, 256, 1280])
PATCHES: torch.Size([6, 100, 1280])
=====================
The attention layers in this model are transitioning from computing the RoPE embeddings internally through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed `position_embeddings` (Tuple of tensors, containing cos and sin). In v4.46 `position_ids` will be removed and `position_embeddings` will be mandatory.
5、多次尝试,翻译失败:未调整任何代码
export LOCAL_MODEL_PATH=/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model
python web_service_unified.py
日志如下:
(deepseek-ocr-mlx) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % export LOCAL_MODEL_PATH=/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model
python web_service_unified.py
==================================================
🚀 DeepSeek-OCR Unified Service
==================================================
📍 URL: http://0.0.0.0:8001
📚 Docs: http://0.0.0.0:8001/docs
==================================================
INFO: Started server process [67116]
INFO: Waiting for application startup.
==================================================
🚀 DeepSeek-OCR Unified Service Starting...
==================================================
📁 Using local model: /Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model
✅ Detected Apple Silicon with MPS support
📦 Loading DeepSeek-OCR with MPS
You are using a model of type deepseek_vl_v2 to instantiate a model of type DeepseekOCR. This is not supported for all configurations of models and can yield errors.
Some weights of DeepseekOCRForCausalLM were not initialized from the model checkpoint at /Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model and are newly initialized: ['model.vision_model.embeddings.position_ids']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
✅ Model loaded on mps
✅ Backend loaded: MPS
==================================================
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO: 127.0.0.1:50888 - "GET / HTTP/1.1" 200 OK
/Users/jat/miniforge3/envs/deepseek-ocr-mlx/lib/python3.11/site-packages/torch/amp/autocast_mode.py:270: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
warnings.warn(
❌ Inference failed: Torch not compiled with CUDA enabled
❌ Error:
Traceback (most recent call last):
File "/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-WebUI/web_service_unified.py", line 235, in ocr_endpoint
text = backend.infer(prompt=prompt, image_path=tmp_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-WebUI/backends/mps_backend.py", line 47, in infer
result = self.model.infer(
^^^^^^^^^^^^^^^^^
File "/Users/jat/.cache/huggingface/modules/transformers_modules/DeepSeek-OCR-Model/modeling_deepseekocr.py", line 935, in infer
input_ids.unsqueeze(0).cuda(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jat/miniforge3/envs/deepseek-ocr-mlx/lib/python3.11/site-packages/torch/cuda/__init__.py", line 403, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
INFO: 127.0.0.1:50889 - "POST /ocr HTTP/1.1" 500 Internal Server Error
MACOS 26.2 M5芯片,32G内存
环境检测:
1、运行自动模式
没有自动下载Model,卡在sing conda environment: deepseek-ocr-mlx,内存占用13G、15G,即使开TUN、全局、退出代理,也是一样的
日志如下:
2、加载本地模型运行: 还是卡在上一步
在Model Scope和Hf-mirror下载的模型都试过。
export LOCAL_MODEL_PATH=/Volumes/MacD/ai/Deepseek/DeepSeek-OCR-Model
./start.sh
3、手动运行:
没有自动下载Model。
日志如下:
4、手动运行:提前修改本地Model位置再python web_service_unified.py
Model 是在Model Scope下载的:
内存溢出:

修改:web_service.py
修改:web_service_unified.py
日志如下:
(deepseek-ocr-mlx) jat@JacoTdeMacBook-Pro DeepSeek-OCR-WebUI % python web_service_unified.py
5、多次尝试,翻译失败:未调整任何代码
日志如下: