File size: 2,403 Bytes
164e64f 72664d1 bda1407 aa80ce8 fc26491 |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# 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())
import os
import tensorflow as tf
# oneDNN ์ต์ ํ ๋นํ์ฑํ
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
# GPU ๋นํ์ฑํ (CUDA ๋ฌธ์ ํด๊ฒฐ ์)
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
# TensorFlow 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())
# Base image
FROM python:3.10-slim
# Install Python packages
RUN pip install --no-cache-dir pip==22.3.1 \
&& pip install --no-cache-dir datasets "huggingface-hub>=0.19" \
"hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
# Install system packages
RUN apt-get update && apt-get install -y \
git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Work directory
WORKDIR /home/user/app
# Copy requirements and install additional Python packages
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY . .
# Set default command
CMD ["streamlit", "run", "app.py"]
import streamlit as st
st.title("Hello, Streamlit!")
st.write("This is a sample Streamlit app.")
|