* download models

* print
This commit is contained in:
Sander Land authored and GitHub committed 2021-01-27 19:18:37 +01:00
1 parent 1cbee4f5e7
commit 79470fd13e
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
PROGRAM_NAME = "KaTrain" PROGRAM_NAME = "KaTrain"
VERSION = "1.7.3" VERSION = "1.7.4"
HOMEPAGE = "https://github.com/sanderland/katrain" HOMEPAGE = "https://github.com/sanderland/katrain"
CONFIG_MIN_VERSION = "1.7.0" # keep config files from this version CONFIG_MIN_VERSION = "1.7.0" # keep config files from this version
ANALYSIS_FORMAT_VERSION = "1.0" ANALYSIS_FORMAT_VERSION = "1.0"
+2 -1
View File
@@ -465,6 +465,7 @@ class BaseConfigPopup(QuickConfigGui):
super().__init__(katrain) super().__init__(katrain)
self.paths = [self.katrain.config("engine/model"), "katrain/models", DATA_FOLDER] self.paths = [self.katrain.config("engine/model"), "katrain/models", DATA_FOLDER]
self.katago_paths = [self.katrain.config("engine/katago"), DATA_FOLDER] self.katago_paths = [self.katrain.config("engine/katago"), DATA_FOLDER]
self.last_clicked_download_models = 0
def check_models(self, *args): def check_models(self, *args):
all_models = [self.MODELS, self.MODEL_DESC, self.katrain.config("dist_models", {})] all_models = [self.MODELS, self.MODEL_DESC, self.katrain.config("dist_models", {})]
@@ -501,6 +502,7 @@ class BaseConfigPopup(QuickConfigGui):
f.replace("/", os.path.sep).replace(PATHS["PACKAGE"], "katrain") f.replace("/", os.path.sep).replace(PATHS["PACKAGE"], "katrain")
for ftype in ["*.bin.gz", "*.txt.gz"] for ftype in ["*.bin.gz", "*.txt.gz"]
for f in glob.glob(slashpath + "/" + ftype) for f in glob.glob(slashpath + "/" + ftype)
if '.tmp.' not in f
] ]
if files and path not in self.paths: if files and path not in self.paths:
self.paths.append(path) # persistent on paths with models found self.paths.append(path) # persistent on paths with models found
@@ -593,7 +595,6 @@ class BaseConfigPopup(QuickConfigGui):
dist_models[name] = json.loads(response.data.decode("utf-8"))["model_file"] dist_models[name] = json.loads(response.data.decode("utf-8"))["model_file"]
except Exception as e: except Exception as e:
self.katrain.log(f"Failed to retrieve info for model: {e}", OUTPUT_INFO) self.katrain.log(f"Failed to retrieve info for model: {e}", OUTPUT_INFO)
self.katrain._config["dist_models"] = dist_models self.katrain._config["dist_models"] = dist_models
self.katrain.save_config(key="dist_models") self.katrain.save_config(key="dist_models")