Raiff1982 commited on
Commit
ec7abe6
·
verified ·
1 Parent(s): 4b3e3d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -8,17 +8,15 @@ from AICoreAGIX_with_TB import AICoreAGIX
8
  import os
9
  os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "true"
10
 
11
- import tensorflow as tf
12
- tf.config.set_logical_device_configuration(
13
- tf.config.list_physical_devices('CPU')[0],
14
- [tf.config.LogicalDeviceConfiguration(memory_limit=2048)]
15
- )
16
  import tensorflow as tf
17
 
18
- # Limit GPU memory usage (important for low-memory environments)
19
  gpus = tf.config.experimental.list_physical_devices('GPU')
20
  for gpu in gpus:
21
- tf.config.experimental.set_memory_growth(gpu, True)
 
 
 
22
 
23
  # Limit CPU memory usage (for Hugging Face Spaces)
24
  tf.config.set_logical_device_configuration(
 
8
  import os
9
  os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "true"
10
 
 
 
 
 
 
11
  import tensorflow as tf
12
 
13
+ # Limit GPU memory usage (if GPU exists)
14
  gpus = tf.config.experimental.list_physical_devices('GPU')
15
  for gpu in gpus:
16
+ try:
17
+ tf.config.experimental.set_memory_growth(gpu, True)
18
+ except RuntimeError as e:
19
+ print(f"[TF] GPU memory growth config error: {e}")
20
 
21
  # Limit CPU memory usage (for Hugging Face Spaces)
22
  tf.config.set_logical_device_configuration(