s2337a commited on
Commit
72664d1
·
verified ·
1 Parent(s): 8b5679f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -2,4 +2,29 @@
2
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
 
4
  tokenizer = AutoTokenizer.from_pretrained("snunlp/KR-FinBert-SC")
5
- model = AutoModelForSequenceClassification.from_pretrained("snunlp/KR-FinBert-SC")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
 
4
  tokenizer = AutoTokenizer.from_pretrained("snunlp/KR-FinBert-SC")
5
+ model = AutoModelForSequenceClassification.from_pretrained("snunlp/KR-FinBert-SC")
6
+
7
+ import os
8
+ import tensorflow as tf
9
+ from absl import logging
10
+
11
+ # 환경 변수 설정
12
+ os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # oneDNN 최적화 비활성화
13
+
14
+ # 로그 초기화
15
+ logging.set_verbosity(logging.INFO)
16
+ logging.use_absl_handler()
17
+
18
+ # GPU 설정
19
+ gpus = tf.config.experimental.list_physical_devices('GPU')
20
+ if gpus:
21
+ try:
22
+ for gpu in gpus:
23
+ tf.config.experimental.set_memory_growth(gpu, True)
24
+ print("GPU 메모리 증가 허용 설정 완료")
25
+ except RuntimeError as e:
26
+ print(f"GPU 설정 오류: {e}")
27
+
28
+ # TensorFlow 및 시스템 정보 확인
29
+ print("TensorFlow 버전:", tf.__version__)
30
+ print("사용 가능한 장치:", tf.config.list_physical_devices())