Runpod compatable CUDA/CPU single/multi label classification
538
This code base supports multi-label and single-label classification tasks using Hugging Face models in the RunPod environment. Efficient inference is facilitated with GPU support.
Set the MODEL_NAME environment variable to specify the model to be used.
export MODEL_NAME="jioo0224/electra-emotion-korean" # this is a private model
Dependencies: Ensure Python, PyTorch, and Transformers libraries are installed.
AutoModelForSequenceClassification and AutoTokenizer are used to load the model and tokenizer based on MODEL_NAME.handler function processes events from RunPod, takes text inputs in batches, and returns prediction results.softmax function.sigmoid function.{
"input": {
"prompt": ["Example text 1", "Example text 2"]
}
}
{
"predictions": [
[
{"label": "label_0", "score": 0.95},
{"label": "label_1", "score": 0.05}
],
[
{"label": "label_0", "score": 0.85},
{"label": "label_1", "score": 0.15}
]
]
}
"Error loading model {model_name}""MODEL_NAME environment variable is not provided."{"error": "Text is not provided or in the wrong format."}This guide and code allow you to run various text classification models seamlessly in RunPod.
이 코드 베이스는 Hugging Face 모델을 사용하여 RunPod 환경에서 multi-label 및 single-label 분류 작업을 지원합니다. GPU 지원을 통해 효율적인 추론을 수행할 수 있습니다.
환경 변수 설정: MODEL_NAME 환경 변수를 설정하여 사용할 모델 이름을 지정합니다.
코드 복사
export MODEL_NAME="jioo0224/electra-emotion-korean" # this is private model
의존성: Python 및 PyTorch, Transformers 라이브러리가 설치되어 있어야 합니다.
{
"input": {
"prompt": ["Example text 1", "Example text 2"]
}
}
출력 형식
{
"predictions": [
[
{"label": "label_0", "score": 0.95},
{"label": "label_1", "score": 0.05}
],
[
{"label": "label_0", "score": 0.85},
{"label": "label_1", "score": 0.15}
]
]
}
Content type
Image
Digest
sha256:b51f948b4…
Size
9.1 GB
Last updated
almost 2 years ago
docker pull dalbodeule/runpod-classification:cuda