File size: 954 Bytes
164e64f 72664d1 |
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 28 29 30 31 |
# 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())
|