Spaces:
Sleeping
Sleeping
terapyon
commited on
Commit
·
763dc1a
1
Parent(s):
6e0a646
added topic model and stop words for lfs
Browse files- .gitattributes +2 -0
- inference.py +8 -5
- saved_model/stop_words/Japanese_selection.txt +3 -0
- saved_model/topic/trained_model.bin +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
saved_model/stop_words/Japanese_selection.txt filter=lfs diff=lfs merge=lfs -text
|
37 |
+
saved_model/topic/trained_model.bin filter=lfs diff=lfs merge=lfs -text
|
inference.py
CHANGED
@@ -13,10 +13,13 @@ import transformers as T # type: ignore
|
|
13 |
from scipy import stats # type: ignore
|
14 |
from sudachipy import dictionary, tokenizer # type: ignore
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
# GPUの指定
|
22 |
if torch.cuda.is_available():
|
@@ -118,7 +121,7 @@ def make_traind_model(bert_model):
|
|
118 |
k = k + 1
|
119 |
model_path = model_base_path / f"trained_model{k}.pt"
|
120 |
trained_model = copy.deepcopy(bert_model)
|
121 |
-
trained_model.load_state_dict(torch.load(model_path, map_location=device),strict=False)
|
122 |
trained_models.append(trained_model)
|
123 |
return trained_models
|
124 |
|
|
|
13 |
from scipy import stats # type: ignore
|
14 |
from sudachipy import dictionary, tokenizer # type: ignore
|
15 |
|
16 |
+
# from transformers import AutoModel
|
17 |
+
|
18 |
+
MODELS_PATH = Path(__file__).parent / "saved_model"
|
19 |
+
model_base_path = MODELS_PATH / "two_class"
|
20 |
+
MODEL_BASE = "terapyon/awarefy-test-trained-"
|
21 |
+
topic_model_trained = MODELS_PATH / "topic" / "trained_model.bin"
|
22 |
+
japanese_selection_path = MODELS_PATH / "stop_words" / "Japanese_selection.txt"
|
23 |
|
24 |
# GPUの指定
|
25 |
if torch.cuda.is_available():
|
|
|
121 |
k = k + 1
|
122 |
model_path = model_base_path / f"trained_model{k}.pt"
|
123 |
trained_model = copy.deepcopy(bert_model)
|
124 |
+
trained_model.load_state_dict(torch.load(model_path, map_location=device), strict=False)
|
125 |
trained_models.append(trained_model)
|
126 |
return trained_models
|
127 |
|
saved_model/stop_words/Japanese_selection.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9654e2f6f739a61285f80538e1076d938f54f090974d8f872ad59b246a66da8
|
3 |
+
size 2202
|
saved_model/topic/trained_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:46c0cc05fcb664763839ca099f04aa5275a269cfbea8847f33214bc73affdcce
|
3 |
+
size 695117
|