Skip to content

memory optimization ready :D#293

Open
furllmm wants to merge 8 commits intoyuka-friends:mainfrom
furllmm:main
Open

memory optimization ready :D#293
furllmm wants to merge 8 commits intoyuka-friends:mainfrom
furllmm:main

Conversation

@furllmm
Copy link
Copy Markdown

@furllmm furllmm commented Jan 25, 2026

Optimizations Implemented:

  1. Lazy Loading for Image Embeddings:

    • Startup Optimization: Removed the proactive loading of the image embedding model in webui.py . The model will now only load when you actually navigate to the Search tab and use "Image Semantic Search" or "Similar Image Search".
    • Smart Caching: Modified windrecorder/ui/components.py to check if the model is already loaded before attempting to load it again, preventing redundant memory usage.
  2. Memory Cleanup Controls:

    • Image Embedding Model: Added an unload_model function in windrecorder/img_embed_manager.py to explicitly release memory occupied by the text/image encoders and processors.
    • OCR Engines: Added an unload_ocr_engine function in windrecorder/ocr_manager.py to release memory used by PaddleOCR, ChineseOCR Lite, or WeChatOCR when they are no longer needed.
  3. New "Memory Management" Section:

    • Added a Memory Management section in the Setting tab.
    • "Unload Embedding Models" Button: Frees up RAM by unloading the image embedding models.
    • "Unload OCR Engines" Button: Frees up RAM by unloading any active OCR engines.
      These changes ensure that the application consumes significantly less RAM on startup and gives you control to free up resources after performing heavy tasks like indexing or searching.

Added a function to unload specific or all OCR engines to free memory, including error handling and logging.
Added buttons to unload embedding models and OCR engines to manage memory usage.
Removed preloading of the embedding model to optimize memory usage, switched to lazy loading.
Added a function to unload the embedding model from memory and clear related session state.
Added a function to unload models and free memory.
Added project details and features for Furllamm Edition.
Updated project information and features in README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant