Delete config.json
Browse files- config.json +0 -22
config.json
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from transformers import AutoConfig, AutoModelForSequenceClassification
|
3 |
-
|
4 |
-
HF_MODEL_DIR = "path/to/model/directory"
|
5 |
-
HF_TASK = "sequence-classification"
|
6 |
-
|
7 |
-
def get_inference_handler_either_custom_or_default_handler(model_dir, task):
|
8 |
-
# ๋ชจ๋ธ ๋๋ ํฐ๋ฆฌ์์ config.json ํ์ผ์ด ์กด์ฌํ๋์ง ํ์ธ
|
9 |
-
config_file = os.path.join(model_dir, "config.json")
|
10 |
-
if not os.path.exists(config_file):
|
11 |
-
raise ValueError(f"Config file not found at {config_file}")
|
12 |
-
|
13 |
-
# ๋ชจ๋ธ ๋ก๋
|
14 |
-
config = AutoConfig.from_pretrained(model_dir)
|
15 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_dir)
|
16 |
-
|
17 |
-
# ํ์ดํ๋ผ์ธ ์์ฑ
|
18 |
-
pipeline = pipeline(task, model=model, tokenizer=config.tokenizer)
|
19 |
-
|
20 |
-
return pipeline
|
21 |
-
|
22 |
-
inference_handler = get_inference_handler_either_custom_or_default_handler(HF_MODEL_DIR, HF_TASK)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|