зеркало из https://github.com/mozilla/bugbug.git
Родитель
9ff32ffed6
Коммит
9575a43e3e
|
@ -177,7 +177,9 @@ class BaseSimilarity(abc.ABC):
|
||||||
return
|
return
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
joblib.dump(self, f"{self.__class__.__name__.lower()}.similaritymodel")
|
path = f"{self.__class__.__name__.lower()}.similaritymodel"
|
||||||
|
joblib.dump(self, path)
|
||||||
|
return path
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(model_file_name):
|
def load(model_file_name):
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
from logging import INFO, basicConfig, getLogger
|
from logging import INFO, basicConfig, getLogger
|
||||||
|
|
||||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||||
|
|
||||||
from bugbug import bugzilla, db, similarity
|
from bugbug import bugzilla, db, similarity
|
||||||
|
from bugbug.utils import zstd_compress
|
||||||
|
|
||||||
basicConfig(level=INFO)
|
basicConfig(level=INFO)
|
||||||
logger = getLogger(__name__)
|
logger = getLogger(__name__)
|
||||||
|
@ -58,7 +60,9 @@ def main():
|
||||||
cleanup_urls=args.cleanup_urls, nltk_tokenizer=args.nltk_tokenizer
|
cleanup_urls=args.cleanup_urls, nltk_tokenizer=args.nltk_tokenizer
|
||||||
)
|
)
|
||||||
|
|
||||||
model.save()
|
path = model.save()
|
||||||
|
assert os.path.exists(path)
|
||||||
|
zstd_compress(path)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Загрузка…
Ссылка в новой задаче