train-modle / .env.example
fokan's picture
Security fix: Remove exposed tokens and implement secure token management
d2bbb3a
# AI Knowledge Distillation Platform - Environment Variables
# منصة تقطير المعرفة للذكاء الاصطناعي - متغيرات البيئة
# =============================================================================
# HUGGING FACE CONFIGURATION | تكوين Hugging Face
# =============================================================================
# Hugging Face Tokens (Required for different access levels)
# رموز Hugging Face (مطلوبة لمستويات وصول مختلفة)
# Get your tokens from: https://huggingface.co/settings/tokens
# Read Token - للتطوير والتعلم والوصول للنماذج العامة
HF_TOKEN_READ=your_read_token_here
# Write Token - لرفع ومشاركة النماذج مع المجتمع
HF_TOKEN_WRITE=your_write_token_here
# Fine-grained Token - للمشاريع التجارية والبيانات الطبية الحساسة
HF_TOKEN_FINE_GRAINED=your_fine_grained_token_here
# Legacy token support (use one of the above specific tokens instead)
HF_TOKEN=your_default_token_here
HUGGINGFACE_TOKEN=your_default_token_here
HUGGINGFACE_HUB_TOKEN=your_default_token_here
# Cache directories for Hugging Face
# مجلدات التخزين المؤقت لـ Hugging Face
HF_HOME=./cache/huggingface
HF_DATASETS_CACHE=./cache/datasets
TRANSFORMERS_CACHE=./cache/transformers
# =============================================================================
# CPU OPTIMIZATION | تحسين المعالج
# =============================================================================
# Number of threads for CPU operations
# عدد الخيوط لعمليات المعالج
OMP_NUM_THREADS=8
MKL_NUM_THREADS=8
NUMEXPR_NUM_THREADS=8
OPENBLAS_NUM_THREADS=8
# Disable GPU (force CPU-only training)
# تعطيل GPU (إجبار التدريب على المعالج فقط)
CUDA_VISIBLE_DEVICES=""
# PyTorch CPU optimizations
# تحسينات PyTorch للمعالج
PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
TOKENIZERS_PARALLELISM=false
# =============================================================================
# MEMORY MANAGEMENT | إدارة الذاكرة
# =============================================================================
# Maximum memory usage in GB (leave 2GB for system)
# الحد الأقصى لاستخدام الذاكرة بالجيجابايت (اترك 2GB للنظام)
MAX_MEMORY_GB=14.0
# Chunk size for large model loading (MB)
# حجم القطعة لتحميل النماذج الكبيرة (ميجابايت)
CHUNK_SIZE_MB=500.0
# Memory cleanup thresholds
# عتبات تنظيف الذاكرة
MEMORY_CLEANUP_THRESHOLD=0.85
MEMORY_EMERGENCY_THRESHOLD=0.95
# =============================================================================
# SERVER CONFIGURATION | تكوين الخادم
# =============================================================================
# Server host and port
# مضيف الخادم والمنفذ
HOST=0.0.0.0
PORT=8000
# Environment (development/production)
# البيئة (تطوير/إنتاج)
ENVIRONMENT=development
# Debug mode
# وضع التصحيح
DEBUG=true
# Resource Limits
# حدود الموارد
MAX_FILE_SIZE=5368709120 # 5GB (optimized for CPU-only)
MAX_MODELS=10
MAX_TRAINING_TIME=3600 # 1 hour
# =============================================================================
# DATABASE CONFIGURATION | تكوين قاعدة البيانات
# =============================================================================
# Database directory
# مجلد قاعدة البيانات
DATABASE_DIR=./database
# Database backup settings
# إعدادات النسخ الاحتياطي لقاعدة البيانات
DB_BACKUP_INTERVAL_HOURS=24
DB_CLEANUP_DAYS=30
# =============================================================================
# LOGGING CONFIGURATION | تكوين السجلات
# =============================================================================
# Log level (DEBUG, INFO, WARNING, ERROR)
# مستوى السجل
LOG_LEVEL=INFO
# Log directory
# مجلد السجلات
LOG_DIR=./logs
# Log file settings
# إعدادات ملف السجل
LOG_MAX_SIZE_MB=100
LOG_BACKUP_COUNT=5
# =============================================================================
# MEDICAL AI CONFIGURATION | تكوين الذكاء الاصطناعي الطبي
# =============================================================================
# DICOM processing settings
# إعدادات معالجة DICOM
DICOM_MEMORY_LIMIT_MB=1000.0
DICOM_DEFAULT_WINDOW_CENTER=40
DICOM_DEFAULT_WINDOW_WIDTH=400
# Medical image processing
# معالجة الصور الطبية
MEDICAL_TARGET_SIZE=512,512
MEDICAL_NORMALIZE_IMAGES=true
MEDICAL_ENHANCE_CONTRAST=true
# =============================================================================
# SECURITY CONFIGURATION | تكوين الأمان
# =============================================================================
# Token encryption settings
# إعدادات تشفير الرموز
TOKEN_ENCRYPTION_KEY_FILE=.token_key
# File upload security
# أمان رفع الملفات
MAX_UPLOAD_SIZE_MB=5000
ALLOWED_EXTENSIONS=.pt,.pth,.bin,.safetensors
# =============================================================================
# PERFORMANCE MONITORING | مراقبة الأداء
# =============================================================================
# System metrics collection
# جمع مقاييس النظام
ENABLE_SYSTEM_METRICS=true
METRICS_INTERVAL_SECONDS=30
STORE_METRICS_IN_DB=true
# Performance alerts
# تنبيهات الأداء
MEMORY_ALERT_THRESHOLD=0.85
ENABLE_PERFORMANCE_RECOMMENDATIONS=true
# =============================================================================
# FEATURE FLAGS | علامات الميزات
# =============================================================================
# Advanced features
# الميزات المتقدمة
ENABLE_MEMORY_MANAGEMENT=true
ENABLE_CHUNK_LOADING=true
ENABLE_CPU_OPTIMIZATION=true
ENABLE_MEDICAL_DATASETS=true
ENABLE_TOKEN_MANAGEMENT=true
# Experimental features
# الميزات التجريبية
ENABLE_AUTO_MODEL_OPTIMIZATION=true
ENABLE_PROGRESSIVE_LOADING=true
ENABLE_SMART_CACHING=true
# =============================================================================
# INSTRUCTIONS | التعليمات
# =============================================================================
# 1. Copy this file to .env: cp .env.example .env
# انسخ هذا الملف إلى .env
#
# 2. Replace placeholder values with your actual values
# استبدل القيم النائبة بقيمك الفعلية
#
# 3. Never commit .env file to version control
# لا تقم أبداً برفع ملف .env إلى نظام التحكم في الإصدارات
#
# 4. For production, use environment-specific values
# للإنتاج، استخدم قيماً خاصة بالبيئة
#
# 5. Restart the application after changing values
# أعد تشغيل التطبيق بعد تغيير القيم