firsttry / app.py
s2337a's picture
Update app.py
72664d1 verified
raw
history blame
954 Bytes
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("snunlp/KR-FinBert-SC")
model = AutoModelForSequenceClassification.from_pretrained("snunlp/KR-FinBert-SC")
import os
import tensorflow as tf
from absl import logging
# ν™˜κ²½ λ³€μˆ˜ μ„€μ •
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' # oneDNN μ΅œμ ν™” λΉ„ν™œμ„±ν™”
# 둜그 μ΄ˆκΈ°ν™”
logging.set_verbosity(logging.INFO)
logging.use_absl_handler()
# GPU μ„€μ •
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
print("GPU λ©”λͺ¨λ¦¬ 증가 ν—ˆμš© μ„€μ • μ™„λ£Œ")
except RuntimeError as e:
print(f"GPU μ„€μ • 였λ₯˜: {e}")
# TensorFlow 및 μ‹œμŠ€ν…œ 정보 확인
print("TensorFlow 버전:", tf.__version__)
print("μ‚¬μš© κ°€λŠ₯ν•œ μž₯치:", tf.config.list_physical_devices())