File size: 832 Bytes
557c6b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Environment setup to handle library conflicts and dependencies
"""

import os
import logging

def setup_environment():
    """Configure environment variables for the application"""
    
    # Disable TensorFlow warnings and prevent it from being loaded
    # This allows Transformers to work without TensorFlow dependencies
    os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"  # Disable TensorFlow logging
    os.environ["USE_TORCH"] = "1"  # Tell Transformers to use PyTorch
    os.environ["USE_TF"] = "0"  # Tell Transformers not to use TensorFlow
    
    # Configure logging
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(levelname)s - %(message)s'
    )
    
    # Log environment settings
    logging.info("Environment configured: PyTorch enabled, TensorFlow disabled")
    
    return True