def getPytorchVersion(cudaVersion, pythonVersion, platform): torchVersion = versionsAccordance[cudaVersion] if cudaVersion is None: print("Pytorch version for cpu will be installed. Proceed? (y/n)") answer = requireAnswer() if answer in ["y", "yes"]: prefix = "https://download.pytorch.org/whl/cpu" torchVersion = "1.1.0" elif answer in ["n", "no"]: return else: print("Pytorch version for gpu will be installed. Proceed? {y/n)") answer = requireAnswer() if answer in ["y", "yes"]: prefix = f"https://download.pytorch.org/whl/cu{cudaVersion}" elif answer in ["n", "no"]: return packages = { "torch": f"{prefix}/torch-{torchVersion}-cp{pythonVersion}-cp{pythonVersion}m-{platform}.whl", "torchvision": f"{prefix}/torchvision-0.3.0-cp{pythonVersion}-cp{pythonVersion}m-{platform}.whl" } return packages
def downloadWeights(proxy=None): folder = os.path.join(_curPath, "Data") filename = "speaker_identification_model.pt" print("\nModel weights will be downloaded. Proceed? (y/n)") answer = requireAnswer() if answer in ["y", "yes"]: pass elif answer in ["n", "no"]: return url = "https://www.dropbox.com/s/khlhunvcfhqwl8r/speaker_identification_model.pt?dl=1" print("Downloading model weights ...") try: downloadFile(url, os.path.join(folder, filename), proxy) except Exception as e: print("Weights downloading error:\n" + str(e)) return print( f"\nModel weights '{filename}' has been successfully placed in {folder}" )
def setProxy(): proxy = "http://proxy.dvfu.ru:3128" print(f"\nSet proxy {proxy}? (y/n)") answer = requireAnswer() if answer in ["y", "yes"]: return proxy elif answer in ["n", "no"]: return
def getMXNetVersion(): cudaVersion = checkCuda() if cudaVersion is None: print("MXNet version for cpu will be installed. Proceed? (y/n)") answer = requireAnswer() if answer in ["y", "yes"]: mxnet_ = "mxnet" elif answer in ["n", "no"]: return else: print("MXNet version for gpu will be installed. Proceed? {y/n)") answer = requireAnswer() if answer in ["y", "yes"]: mxnet_ = "mxnet-cu{}".format(cudaVersion) elif answer in ["n", "no"]: return return mxnet_
def downloadWeights(proxy=None): folder = os.path.join(_curPath, "Data") filename = "face_detection_model-0000.params" print("\nModel weights will be downloaded. Proceed? (y/n)") answer = requireAnswer() if answer in ["y", "yes"]: pass elif answer in ["n", "no"]: return url = "https://www.dropbox.com/s/um4enc3hmcn83y6/face_detection_model-0000.params?dl=1" print("Downloading model weights ...") try: downloadFile(url, os.path.join(folder, filename), proxy) except Exception as e: print("Weights downloading error:\n" + str(e)) return print(f"\nModel weights '{filename}' has been successfully placed in {folder}")