-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Describe the bug
在 conda 环境 python=3.13 时,根据教程安装 memos 后出现ValueError: Global.lang_det is not a valid key.。并在 python=3.11/12 时也这样
Command outputs
memos serve
Database initialized successfully at sqlite:////Users/zhengyang/.memos/database.db
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /opt/anaconda3/envs/memos/lib/python3.13/site-packages/memos/commands.py:98 │
│ in serve │
│ │
│ 95 │ │ │ run_migrations() │
│ 96 │ │ │ │
│ 97 │ │ │ from .server import run_server │
│ ❱ 98 │ │ │ run_server() │
│ 99 │ │ else: │
│ 100 │ │ │ print("Server initialization failed. Unable to start the s │
│ 101 │ finally: │
│ │
│ ╭───── locals ──────╮ │
│ │ db_success = True │ │
│ ╰───────────────────╯ │
│ │
│ /opt/anaconda3/envs/memos/lib/python3.13/site-packages/memos/server.py:1107 │
│ in run_server │
│ │
│ 1104 │ │
│ 1105 │ # Only add OCR plugin router if enabled │
│ 1106 │ if settings.ocr.enabled: │
│ ❱ 1107 │ │ ocr_main.init_plugin(settings.ocr) │
│ 1108 │ │ api_router.include_router(ocr_main.router, prefix="/plugins/o │
│ 1109 │ │ logging.info("OCR plugin initialized and router added") │
│ 1110 │ else: │
│ │
│ /opt/anaconda3/envs/memos/lib/python3.13/site-packages/memos/plugins/ocr/mai │
│ n.py:243 in init_plugin │
│ │
│ 240 │ │ │ ocr = RapidOCR(params=config_params) │
│ 241 │ │ else: │
│ 242 │ │ │ config_params["Global.with_onnx"] = True │
│ ❱ 243 │ │ │ ocr = RapidOCR(params=config_params) │
│ 244 │ │ │
│ 245 │ │ thread_pool = ThreadPoolExecutor(max_workers=concurrency) │
│ 246 │
│ │
│ ╭─────────────────────────── locals ────────────────────────────╮ │
│ │ config = OCRSettings( │ │
│ │ │ endpoint='http://localhost:5555/predict', │ │
│ │ │ token=SecretStr(''), │ │
│ │ │ concurrency=8, │ │
│ │ │ use_local=True, │ │
│ │ │ force_jpeg=False, │ │
│ │ │ enabled=True │ │
│ │ ) │ │
│ │ config_params = { │ │
│ │ │ 'Global.width_height_ratio': 40, │ │
│ │ │ 'Global.lang_det': 'ch_mobile', │ │
│ │ │ 'Global.lang_rec': 'ch_mobile', │ │
│ │ │ 'Global.with_onnx': True │ │
│ │ } │ │
│ ╰───────────────────────────────────────────────────────────────╯ │
│ │
│ /opt/anaconda3/envs/memos/lib/python3.13/site-packages/rapidocr/main.py:38 │
│ in init │
│ │
│ 35 │ def init( │
│ 36 │ │ self, config_path: Optional[str] = None, params: Optional[Dict │
│ 37 │ ): │
│ ❱ 38 │ │ cfg = self.load_config(config_path, params) │
│ 39 │ │ self.initialize(cfg) │
│ 40 │ │ │
│ 41 │ │ self.logger = Logger(logger_name=name).get_log() │
│ │
│ ╭─────────────────────────── locals ───────────────────────────╮ │
│ │ config_path = None │ │
│ │ params = { │ │
│ │ │ 'Global.width_height_ratio': 40, │ │
│ │ │ 'Global.lang_det': 'ch_mobile', │ │
│ │ │ 'Global.lang_rec': 'ch_mobile', │ │
│ │ │ 'Global.with_onnx': True │ │
│ │ } │ │
│ │ self = <rapidocr.main.RapidOCR object at 0x10f2d0d70> │ │
│ ╰──────────────────────────────────────────────────────────────╯ │
│ │
│ /opt/anaconda3/envs/memos/lib/python3.13/site-packages/rapidocr/main.py:52 │
│ in load_config │
│ │
│ 49 │ │ │ cfg = ParseParams.load(DEFAULT_CFG_PATH) │
│ 50 │ │ │
│ 51 │ │ if params: │
│ ❱ 52 │ │ │ cfg = ParseParams.update_batch(cfg, params) │
│ 53 │ │ return cfg │
│ 54 │ │
│ 55 │ def initialize(self, cfg: DictConfig): │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ cfg = {'Global': {'text_score': 0.5, 'use_det': True, 'use_cls': │ │
│ │ True, 'use_rec': True, 'min_height': 30, │ │
│ │ 'width_height_ratio': 40, 'max_side_len': 2000, │ │
│ │ 'min_side_len': 30, 'return_word_box': False, │ │
│ │ 'return_single_char_box': False, 'font_path': None}, │ │
│ │ 'EngineConfig': {'onnxruntime': {'intra_op_num_threads': │ │
│ │ -1, 'inter_op_num_threads': -1, 'enable_cpu_mem_arena': │ │
│ │ False, 'cpu_ep_cfg': {'arena_extend_strategy': │ │
│ │ 'kSameAsRequested'}, 'use_cuda': False, 'cuda_ep_cfg': │ │
│ │ {'device_id': 0, 'arena_extend_strategy': │ │
│ │ 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', │ │
│ │ 'do_copy_in_default_stream': True}, 'use_dml': False, │ │
│ │ 'dm_ep_cfg': None, 'use_cann': False, 'cann_ep_cfg': │ │
│ │ {'device_id': 0, 'arena_extend_strategy': │ │
│ │ 'kNextPowerOfTwo', 'npu_mem_limit': 21474836480, │ │
│ │ 'op_select_impl_mode': 'high_performance', │ │
│ │ 'optypelist_for_implmode': 'Gelu', 'enable_cann_graph': │ │
│ │ True}}, 'openvino': {'inference_num_threads': -1}, │ │
│ │ 'paddle': {'cpu_math_library_num_threads': -1, 'use_cuda': │ │
│ │ False, 'gpu_id': 0, 'gpu_mem': 500}, 'torch': {'use_cuda': │ │
│ │ False, 'gpu_id': 0}}, 'Det': {'engine_type': │ │
│ │ <EngineType.ONNXRUNTIME: 'onnxruntime'>, 'lang_type': │ │
│ │ <LangDet.CH: 'ch'>, 'model_type': <ModelType.MOBILE: │ │
│ │ 'mobile'>, 'ocr_version': <OCRVersion.PPOCRV4: │ │
│ │ 'PP-OCRv4'>, 'task_type': <TaskType.DET: 'det'>, │ │
│ │ 'model_path': None, 'model_dir': None, 'limit_side_len': │ │
│ │ 736, 'limit_type': 'min', 'std': [0.5, 0.5, 0.5], 'mean': │ │
│ │ [0.5, 0.5, 0.5], 'thresh': 0.3, 'box_thresh': 0.5, │ │
│ │ 'max_candidates': 1000, 'unclip_ratio': 1.6, │ │
│ │ 'use_dilation': True, 'score_mode': 'fast'}, 'Cls': │ │
│ │ {'engine_type': <EngineType.ONNXRUNTIME: 'onnxruntime'>, │ │
│ │ 'lang_type': <LangCls.CH: 'ch'>, 'model_type': │ │
│ │ <ModelType.MOBILE: 'mobile'>, 'ocr_version': │ │
│ │ <OCRVersion.PPOCRV4: 'PP-OCRv4'>, 'task_type': │ │
│ │ <TaskType.CLS: 'cls'>, 'model_path': None, 'model_dir': │ │
│ │ None, 'cls_image_shape': [3, 48, 192], 'cls_batch_num': 6, │ │
│ │ 'cls_thresh': 0.9, 'label_list': ['0', '180']}, 'Rec': │ │
│ │ {'engine_type': <EngineType.ONNXRUNTIME: 'onnxruntime'>, │ │
│ │ 'lang_type': <LangRec.CH: 'ch'>, 'model_type': │ │
│ │ <ModelType.MOBILE: 'mobile'>, 'ocr_version': │ │
│ │ <OCRVersion.PPOCRV4: 'PP-OCRv4'>, 'task_type': │ │
│ │ <TaskType.REC: 'rec'>, 'model_path': None, 'model_dir': │ │
│ │ None, 'rec_keys_path': None, 'rec_img_shape': [3, 48, │ │
│ │ 320], 'rec_batch_num': 6}} │ │
│ │ config_path = None │ │
│ │ params = { │ │
│ │ │ 'Global.width_height_ratio': 40, │ │
│ │ │ 'Global.lang_det': 'ch_mobile', │ │
│ │ │ 'Global.lang_rec': 'ch_mobile', │ │
│ │ │ 'Global.with_onnx': True │ │
│ │ } │ │
│ │ self = <rapidocr.main.RapidOCR object at 0x10f2d0d70> │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /opt/anaconda3/envs/memos/lib/python3.13/site-packages/rapidocr/utils/parse_ │
│ parameters.py:46 in update_batch │
│ │
│ 43 │ │ ] │
│ 44 │ │ for k, v in params.items(): │
│ 45 │ │ │ if k.startswith("Global") and k.split(".")[1] not in global │
│ ❱ 46 │ │ │ │ raise ValueError(f"{k} is not a valid key.") │
│ 47 │ │ │ │
│ 48 │ │ │ if k.split(".")[1] in enum_params and not isinstance(v, Enu │
│ 49 │ │ │ │ raise TypeError(f"The value of {k} must be Enum Type.") │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ cfg = {'Global': {'text_score': 0.5, 'use_det': True, 'use_cls': │ │
│ │ True, 'use_rec': True, 'min_height': 30, │ │
│ │ 'width_height_ratio': 40, 'max_side_len': 2000, │ │
│ │ 'min_side_len': 30, 'return_word_box': False, │ │
│ │ 'return_single_char_box': False, 'font_path': None}, │ │
│ │ 'EngineConfig': {'onnxruntime': {'intra_op_num_threads': │ │
│ │ -1, 'inter_op_num_threads': -1, 'enable_cpu_mem_arena': │ │
│ │ False, 'cpu_ep_cfg': {'arena_extend_strategy': │ │
│ │ 'kSameAsRequested'}, 'use_cuda': False, 'cuda_ep_cfg': │ │
│ │ {'device_id': 0, 'arena_extend_strategy': │ │
│ │ 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', │ │
│ │ 'do_copy_in_default_stream': True}, 'use_dml': False, │ │
│ │ 'dm_ep_cfg': None, 'use_cann': False, 'cann_ep_cfg': │ │
│ │ {'device_id': 0, 'arena_extend_strategy': │ │
│ │ 'kNextPowerOfTwo', 'npu_mem_limit': 21474836480, │ │
│ │ 'op_select_impl_mode': 'high_performance', │ │
│ │ 'optypelist_for_implmode': 'Gelu', 'enable_cann_graph': │ │
│ │ True}}, 'openvino': {'inference_num_threads': -1}, │ │
│ │ 'paddle': {'cpu_math_library_num_threads': -1, 'use_cuda': │ │
│ │ False, 'gpu_id': 0, 'gpu_mem': 500}, 'torch': {'use_cuda': │ │
│ │ False, 'gpu_id': 0}}, 'Det': {'engine_type': │ │
│ │ <EngineType.ONNXRUNTIME: 'onnxruntime'>, 'lang_type': │ │
│ │ <LangDet.CH: 'ch'>, 'model_type': <ModelType.MOBILE: │ │
│ │ 'mobile'>, 'ocr_version': <OCRVersion.PPOCRV4: │ │
│ │ 'PP-OCRv4'>, 'task_type': <TaskType.DET: 'det'>, │ │
│ │ 'model_path': None, 'model_dir': None, 'limit_side_len': │ │
│ │ 736, 'limit_type': 'min', 'std': [0.5, 0.5, 0.5], 'mean': │ │
│ │ [0.5, 0.5, 0.5], 'thresh': 0.3, 'box_thresh': 0.5, │ │
│ │ 'max_candidates': 1000, 'unclip_ratio': 1.6, │ │
│ │ 'use_dilation': True, 'score_mode': 'fast'}, 'Cls': │ │
│ │ {'engine_type': <EngineType.ONNXRUNTIME: 'onnxruntime'>, │ │
│ │ 'lang_type': <LangCls.CH: 'ch'>, 'model_type': │ │
│ │ <ModelType.MOBILE: 'mobile'>, 'ocr_version': │ │
│ │ <OCRVersion.PPOCRV4: 'PP-OCRv4'>, 'task_type': │ │
│ │ <TaskType.CLS: 'cls'>, 'model_path': None, 'model_dir': │ │
│ │ None, 'cls_image_shape': [3, 48, 192], 'cls_batch_num': 6, │ │
│ │ 'cls_thresh': 0.9, 'label_list': ['0', '180']}, 'Rec': │ │
│ │ {'engine_type': <EngineType.ONNXRUNTIME: 'onnxruntime'>, │ │
│ │ 'lang_type': <LangRec.CH: 'ch'>, 'model_type': │ │
│ │ <ModelType.MOBILE: 'mobile'>, 'ocr_version': │ │
│ │ <OCRVersion.PPOCRV4: 'PP-OCRv4'>, 'task_type': │ │
│ │ <TaskType.REC: 'rec'>, 'model_path': None, 'model_dir': │ │
│ │ None, 'rec_keys_path': None, 'rec_img_shape': [3, 48, │ │
│ │ 320], 'rec_batch_num': 6}} │ │
│ │ enum_params = [ │ │
│ │ │ 'engine_type', │ │
│ │ │ 'model_type', │ │
│ │ │ 'ocr_version', │ │
│ │ │ 'lang_type', │ │
│ │ │ 'task_type' │ │
│ │ ] │ │
│ │ global_keys = [ │ │
│ │ │ 'text_score', │ │
│ │ │ 'use_det', │ │
│ │ │ 'use_cls', │ │
│ │ │ 'use_rec', │ │
│ │ │ 'min_height', │ │
│ │ │ 'width_height_ratio', │ │
│ │ │ 'max_side_len', │ │
│ │ │ 'min_side_len', │ │
│ │ │ 'return_word_box', │ │
│ │ │ 'return_single_char_box', │ │
│ │ │ ... +1 │ │
│ │ ] │ │
│ │ k = 'Global.lang_det' │ │
│ │ params = { │ │
│ │ │ 'Global.width_height_ratio': 40, │ │
│ │ │ 'Global.lang_det': 'ch_mobile', │ │
│ │ │ 'Global.lang_rec': 'ch_mobile', │ │
│ │ │ 'Global.with_onnx': True │ │
│ │ } │ │
│ │ v = 'ch_mobile' │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
ValueError: Global.lang_det is not a valid key.
Screenshots or additional context
No response