MultiModal_RAG / config.py
Aayan873's picture
Upload 8 files
aad6058 verified
Raw History Blame Contribute Delete
1.88 kB
# Configuration file for Multimodal RAG System - Deployment Optimized
import os
from pathlib import Path
# Model configurations - optimized for CPU deployment
MODELS_CONFIG = {
"text_encoder": "all-MiniLM-L6-v2", # Fast, small text encoder
"clip_model": "openai/clip-vit-base-patch32", # Balanced CLIP model
"whisper_small": "base", # Use base model for better CPU performance
"whisper_base": "base",
"llm_model": "mistral-7b-openorca.Q4_0.gguf" # Quantized model for CPU
}
# File type configurations
SUPPORTED_DOCUMENT_TYPES = ['pdf', 'docx', 'txt']
SUPPORTED_IMAGE_TYPES = ['png', 'jpg', 'jpeg', 'webp']
SUPPORTED_AUDIO_TYPES = ['mp3', 'wav', 'ogg', 'm4a']
# Processing configurations
EMBEDDING_DIMENSIONS = {
"text": 384,
"clip_large": 768,
"clip_base": 512
}
# GPU settings (for local development)
GPU_MEMORY_FRACTION = 0.7 # Use 70% of GPU memory if available
FAISS_TEMP_MEMORY = 256 * 1024 * 1024 # 256MB for FAISS operations
# Data storage - optimized for deployment
DATA_DIRECTORY = Path("./rag_data")
DATA_FILES = {
"documents": "documents.json",
"metadata": "metadata.json",
"faiss_index": "faiss_index.bin",
"embeddings": "embeddings.npy"
}
# Generation settings - optimized for CPU
DEFAULT_TOP_K = 5
MAX_CONTEXT_LENGTH = 2048 # Reduced for faster processing
LLM_TEMPERATURE = 0.7
LLM_MAX_TOKENS = 512 # Reduced for faster response
# Streamlit configuration
STREAMLIT_CONFIG = {
"page_title": "Multimodal RAG System",
"layout": "wide",
"initial_sidebar_state": "expanded"
}
# Deployment specific settings
DEPLOYMENT_MODE = os.getenv("DEPLOYMENT_MODE", "local") # local, spaces, cloud
MAX_FILE_SIZE_MB = 50 # Max upload size in MB
ENABLE_GPU = os.getenv("ENABLE_GPU", "auto") # auto, true, false
# Demo content for deployment
DEMO_ENABLED = True
DEMO_FILES_PATH = Path("./demo_files")