Exemple #1
0
def install_neural_networks():
    #Sets up Neural Networks folder
    #Another script will use SVN to selectively pull stuff as needed. 
    root = get_set_root()
    if os.path.isdir(os.path.join(root, "../NeuralNetworks")):
        s = subprocess.run([os.path.join(root, "../bin/PortableSub/bin/svn.exe"), "update", "--set-depth", "immediates", os.path.join(root, "../NeuralNetworks")], check=True, shell=True)
    else:
        s = subprocess.run([os.path.join(root, "../bin/PortableSub/bin/svn.exe"), "checkout", "--depth", "immediates", modelurl, os.path.join(root, "../NeuralNetworks")], check=True, shell=True)
    os.chdir(root)
Exemple #2
0
def install_svn():
    #Downloads SVN, used for selectively pulling giant repos
    root = get_set_root()
    if not os.path.isfile(os.path.join(root, "../bin/PortableSub/bin/svn.exe")):
        #get URL for SVN download
        print("Fetching SVN URL...")
        svnurl = str(urllib.request.urlopen(svnurlurl).read().decode()).rstrip()
        print("Downloading SVN archive...")
        svnarchivedir = download(svnurl)
        s = subprocess.run([os.path.join(root, "../bin/7za.exe"), "x", svnarchivedir, "-o" + os.path.join(root, "../bin/PortableSub"), "-aoa"], check=True, shell=True)
def install_mxnet_gpu(cver):
    #Installs the appropriate version of mxnet with pip
    root = get_set_root()
    cudastr = cver.replace(".", "")
    mxmodule = "mxnet-cu" + cudastr
    try: 
        subprocess.run([sys.executable, "-m", "pip", "install", mxmodule, "--upgrade"], shell=True, check=True)
    except:
        print("ERROR: mxnet module for CUDA " + cudafull + "is not availible!")
        print("Please install an appropriate version of CUDA and rerun this update script, if you want MXNet processing")
        print("")
        input("Press ENTER to continue...")
Exemple #4
0
def download_ffmpeg():
    root = get_set_root()
    ffmpegdir = os.path.join(root, "../bin/ffmpeg.exe")
    if not os.path.isfile(ffmpegdir):
        print("Downloading ffmpeg...")
        print(" ")
        d = download(ffurl)
        zipexedir = os.path.join(root, "../bin/7za.exe")
        with tempfile.TemporaryDirectory() as t:
            subprocess.run([zipexedir, "x", d, "-o" + t], shell=True, check=True)
            ffmpegfile = glob.glob(os.path.join(t, "/**/ffmpeg.exe"), recursive=True)
            shutil.move(src=ffmpegfile[0], dst=ffmpegdir)
Exemple #5
0
def download_mx_plugin():
    #Downloads and moves kice's MXNet plugin. Automatically gets newest release. 
    root = get_set_root()
    print("Downloading MXNet Plugin...")
    print(" ")
    rurl = get_latest_release_github(mxurl)
    d = download(rurl)
    if os.path.isdir("MXNet"):
        shutil.rmtree("MXNet")
    with tempfile.TemporaryDirectory() as t:    
        zipfile.ZipFile(d).extractall(path=t)
        mxfile = glob.glob(os.path.join(t, "/**/vs_mxnet.dll"), recursive=True)
        os.mkdir("MXNet")
        shutil.move(src=mxfile[0], dst="MXNet")
def install_vsgan_gpu(cver):
    root = get_set_root()
    if cver == "10.1":
        subprocess.run([sys.executable, "-m", "pip", "install"] + torchgpu101 + ["--upgrade"], shell=True, check=True)
        subprocess.run([sys.executable, "-m", "pip", "install", "vsgan", "--upgrade"], shell=True, check=True)
        print("Installed VSRGAN for CUDA 10.1")
        print (" ")
        create_vsgan_folder()

    elif cver == "9.2":
        subprocess.run([sys.executable, "-m", "pip", "install"] + torchgpu92 + ["vsgan" "--upgrade"], shell=True, check=True)
        subprocess.run([sys.executable, "-m", "pip", "install" + "vsgan" "--upgrade"], shell=True, check=True)
        print("Installed VSRGAN for CUDA 9.2")
        print(" ")
        create_vsgan_folder()
    else:
        print("Unable to install VSGAN, as it requires CUDA 10.1 or CUDA 9.2")
        print("Please rerunn the installer and reinstall CUDA if you want to use VSGAN")
        print(" ")
        input("Press ENTER to continue...")
        choice = input("Yes/No:")
        if choice.lower() == 'yes':
            install_cuda(ujson)
            install_cudnn(cver, ujson)


#Check for, install, and verify CUDA and cuDNN
if __name__ == "__main__":
    try:
        ret = run_as_admin()
        if ret is None:
            #Documentations claims this is getting admin privledges
            print("Getting admin rights...")
        if ret is True:
            #This branch only runs with admin privledges
            root = get_set_root()
            print("Installing CUDA stuff!")
            print("Please note that this Python script needs Admin privledges to access CUDA/cuDNN in Program Files")
            print(" ")
            input("Press ENTER to continue...")
            print(" ")
            print("Fetching cuDNN version table from GitHub")
            urljson = download(CUDAJSON, getjson=True)
            print(' ')
            if check_cuda():
                print("Existing CUDA installation detected!")
                cver = get_cuda_ver()
                if check_cudnn():
                    print("cuDNN files found!")
                else: 
                    install_cudnn(cver, urljson)
Exemple #8
0
def install_vsgan_cpu():
    root = get_set_root()
    if not get_gpu_vendor()[0]:
        subprocess.run([sys.executable, "-m", "pip", "install"] + torchstuff + ["--upgrade"], shell=True, check=True)
        subprocess.run([sys.executable, "-m", "pip", "install", "vsgan", "--upgrade"], shell=True, check=True)
        create_vsgan_folder()
Exemple #9
0
def install_python_modules():
    #Pip!
    root = get_set_root()
    subprocess.run([sys.executable, "-m", "pip", "install"] + pipmodules + ["--upgrade"], shell=True, check=True)
Exemple #10
0
def install_mxnet_cpu():
    #Installs the appropriate version of mxnet with pip
    root = get_set_root()
    subprocess.run([sys.executable, "-m", "pip", "install", cpumxmodule, "--upgrade"], shell=True, check=True)