Spaces:
Runtime error
Runtime error
Commit
·
8ee03b1
1
Parent(s):
debd5fd
Update app/main.py
Browse files- app/main.py +2 -1
app/main.py
CHANGED
|
@@ -14,6 +14,7 @@ MODELS_PATH = "kadabengaran/IndoBERT-BiLSTM-Useful-App-Review"
|
|
| 14 |
|
| 15 |
id2label= {0: 'Other', 1: 'Problem Discovery', 2: 'Information Seeking', 3: 'Feature Request'}
|
| 16 |
label2id= {'Other': 0, 'Problem Discovery': 1, 'Information Seeking': 2, 'Feature Request': 3}
|
|
|
|
| 17 |
|
| 18 |
def get_device():
|
| 19 |
if torch.cuda.is_available():
|
|
@@ -53,7 +54,7 @@ def remove_special_characters(text):
|
|
| 53 |
def load_model():
|
| 54 |
config = PeftConfig.from_pretrained(MODELS_PATH)
|
| 55 |
inference_model = AutoModelForSequenceClassification.from_pretrained(
|
| 56 |
-
config.base_model_name_or_path, num_labels=
|
| 57 |
)
|
| 58 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
| 59 |
model = PeftModel.from_pretrained(inference_model, MODELS_PATH)
|
|
|
|
| 14 |
|
| 15 |
id2label= {0: 'Other', 1: 'Problem Discovery', 2: 'Information Seeking', 3: 'Feature Request'}
|
| 16 |
label2id= {'Other': 0, 'Problem Discovery': 1, 'Information Seeking': 2, 'Feature Request': 3}
|
| 17 |
+
numLabels= 4
|
| 18 |
|
| 19 |
def get_device():
|
| 20 |
if torch.cuda.is_available():
|
|
|
|
| 54 |
def load_model():
|
| 55 |
config = PeftConfig.from_pretrained(MODELS_PATH)
|
| 56 |
inference_model = AutoModelForSequenceClassification.from_pretrained(
|
| 57 |
+
config.base_model_name_or_path, num_labels=numLabels, id2label=id2label, label2id=label2id
|
| 58 |
)
|
| 59 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
| 60 |
model = PeftModel.from_pretrained(inference_model, MODELS_PATH)
|