s2337a commited on
Commit
bda1407
ยท
verified ยท
1 Parent(s): 72664d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -28,3 +28,26 @@ if gpus:
28
  # TensorFlow ๋ฐ ์‹œ์Šคํ…œ ์ •๋ณด ํ™•์ธ
29
  print("TensorFlow ๋ฒ„์ „:", tf.__version__)
30
  print("์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์น˜:", tf.config.list_physical_devices())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  # TensorFlow ๋ฐ ์‹œ์Šคํ…œ ์ •๋ณด ํ™•์ธ
29
  print("TensorFlow ๋ฒ„์ „:", tf.__version__)
30
  print("์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์น˜:", tf.config.list_physical_devices())
31
+
32
+ import os
33
+ import tensorflow as tf
34
+
35
+ # oneDNN ์ตœ์ ํ™” ๋น„ํ™œ์„ฑํ™”
36
+ os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
37
+
38
+ # GPU ๋น„ํ™œ์„ฑํ™” (CUDA ๋ฌธ์ œ ํ•ด๊ฒฐ ์‹œ)
39
+ os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
40
+
41
+ # TensorFlow GPU ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •
42
+ gpus = tf.config.experimental.list_physical_devices('GPU')
43
+ if gpus:
44
+ try:
45
+ for gpu in gpus:
46
+ tf.config.experimental.set_memory_growth(gpu, True)
47
+ print("GPU ๋ฉ”๋ชจ๋ฆฌ ์ฆ๊ฐ€ ํ—ˆ์šฉ ์„ค์ • ์™„๋ฃŒ")
48
+ except RuntimeError as e:
49
+ print(f"GPU ์„ค์ • ์˜ค๋ฅ˜: {e}")
50
+
51
+ # TensorFlow ์‹คํ–‰ ํ™•์ธ
52
+ print("TensorFlow ๋ฒ„์ „:", tf.__version__)
53
+ print("์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์žฅ์น˜:", tf.config.list_physical_devices())