Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def show_install(show_nvidia_smi:bool=False):
"Print user's setup information"
import platform, fastai.version
rep = []
opt_mods = []
rep.append(["=== Software ===", None])
rep.append(["python", platform.python_version()])
rep.append(["fastai", fastai.__version__])
rep.append(["fastprogress", fastprogress.__version__])
rep.append(["torch", torch.__version__])
# nvidia-smi
cmd = "nvidia-smi"
have_nvidia_smi = False
try: result = subprocess.run(cmd.split(), shell=False, check=False, stdout=subprocess.PIPE)
except: pass
else:
if result.returncode == 0 and result.stdout: have_nvidia_smi = True
# XXX: if nvidia-smi is not available, another check could be:
# /proc/driver/nvidia/version on most systems, since it's the
# currently active version
if have_nvidia_smi:
smi = result.stdout.decode('utf-8')
def show_install(show_nvidia_smi:bool=False):
"Print user's setup information: python -c 'import fastai; fastai.show_install()'"
import platform, fastai.version
rep = []
opt_mods = []
rep.append(["=== Software ===", None])
rep.append(["python", platform.python_version()])
rep.append(["fastai", fastai.__version__])
rep.append(["fastprogress", fastprogress.__version__])
rep.append(["torch", torch.__version__])
# nvidia-smi
cmd = "nvidia-smi"
have_nvidia_smi = False
try:
result = subprocess.run(cmd.split(), shell=False, check=False, stdout=subprocess.PIPE)
except:
pass
else:
if result.returncode == 0 and result.stdout:
have_nvidia_smi = True
# XXX: if nvidia-smi is not available, another check could be:
# /proc/driver/nvidia/version on most systems, since it's the
# currently active version
def on_button_clicked_info(b):
with out:
clear_output()
RED = '\033[31m'
BLUE = '\033[94m'
GREEN = '\033[92m'
BOLD = '\033[1m'
ITALIC = '\033[3m'
RESET = '\033[0m'
import fastai; print(BOLD + BLUE + "fastai Version: " + RESET + ITALIC + str(fastai.__version__))
import fastprogress; print(BOLD + BLUE + "fastprogress Version: " + RESET + ITALIC + str(fastprogress.__version__))
import sys; print(BOLD + BLUE + "python Version: " + RESET + ITALIC + str(sys.version))
import torchvision; print(BOLD + BLUE + "torchvision: " + RESET + ITALIC + str(torchvision.__version__))
import torch; print(BOLD + BLUE + "torch version: " + RESET + ITALIC + str(torch.__version__))
print(BOLD + BLUE + "\nCuda: " + RESET + ITALIC + str(torch.cuda.is_available()))
print(BOLD + BLUE + "cuda Version: " + RESET + ITALIC + str(torch.version.cuda))
print(BOLD + BLUE + "GPU: " + RESET + ITALIC + str(torch.cuda.get_device_name(0)))
def dashboard_one():
"""GUI for first accordion window"""
import psutil
import torchvision
try:
import fastai2; fastver = fastai2.__version__
except ImportError:
fastver = 'fastai not found'
try:
import fastprogress; fastprog = fastprogress.__version__
except ImportError:
fastprog = 'fastprogress not found'
try:
import fastpages; fastp = fastpages.__version__
except ImportError:
fastp = 'fastpages not found'
try:
import nbdev; nbd = nbdev.__version__
except ImportError:
nbd = 'nbdev not found'
print (BOLD + RED + '>> Vision_UI Update: 03/17/2020')
style = {'description_width': 'initial'}
button = widgets.Button(description='System', button_style='success')
ex_button = widgets.Button(description='Explore', button_style='success')