Commit ·
cf3150e
1
Parent(s): 556dd64
nvidia fix
Browse files12345619 unmodified lines262728293031323334275 unmodified lines310311312313314315316317import osos.system('pip freeze')import torchtorch.hub.download_url_to_file('https://heibox.uni-heidelberg.de/d/a7530b09fed84f80a887/files/?p=%2Fconfigs%2Fmodel.yaml&dl=1', 'vqgan_imagenet_f16_16384.yaml')torch.hub.download_url_to_file('https://heibox.uni-heidelberg.de/d/a7530b09fed84f80a887/files/?p=%2Fckpts%2Flast.ckpt&dl=1', 'vqgan_imagenet_f16_16384.ckpt')19 unmodified linesfrom PIL import ImageFile, ImageImageFile.LOAD_TRUNCATED_IMAGES = Trueimport gradio as grimport nvidia_sminvidia_smi.nvmlInit()handle = nvidia_smi.nvmlDeviceGetHandleByIndex(0)# card id 0 hardcoded here, there is also a call to get all available card ids, so we could iteratetorch.hub.download_url_to_file('https://images.pexels.com/photos/158028/bellingrath-gardens-alabama-landscape-scenic-158028.jpeg', 'garden.jpeg')torch.hub.download_url_to_file('https://images.pexels.com/photos/68767/divers-underwater-ocean-swim-68767.jpeg', 'coralreef.jpeg')275 unmodified linesout = synth(z)# TF.to_pil_image(out[0].cpu()).save('progress.png')# display.display(display.Image('progress.png'))res = nvidia_smi.nvmlDeviceGetUtilizationRates(handle)print(f'gpu: {res.gpu}%, gpu-mem: {res.memory}%')def ascend_txt():# global iout = synth(z)1234567819 unmodified lines282930313233343536275 unmodified lines312313314315316317318319import osos.system('pip freeze')import nvidia_sminvidia_smi.nvmlInit()exit()import torchtorch.hub.download_url_to_file('https://heibox.uni-heidelberg.de/d/a7530b09fed84f80a887/files/?p=%2Fconfigs%2Fmodel.yaml&dl=1', 'vqgan_imagenet_f16_16384.yaml')torch.hub.download_url_to_file('https://heibox.uni-heidelberg.de/d/a7530b09fed84f80a887/files/?p=%2Fckpts%2Flast.ckpt&dl=1', 'vqgan_imagenet_f16_16384.ckpt')19 unmodified linesfrom PIL import ImageFile, ImageImageFile.LOAD_TRUNCATED_IMAGES = Trueimport gradio as gr#import nvidia_smi#nvidia_smi.nvmlInit()#handle = nvidia_smi.nvmlDeviceGetHandleByIndex(0)# card id 0 hardcoded here, there is also a call to get all available card ids, so we could iteratetorch.hub.download_url_to_file('https://images.pexels.com/photos/158028/bellingrath-gardens-alabama-landscape-scenic-158028.jpeg', 'garden.jpeg')torch.hub.download_url_to_file('https://images.pexels.com/photos/68767/divers-underwater-ocean-swim-68767.jpeg', 'coralreef.jpeg')275 unmodified linesout = synth(z)# TF.to_pil_image(out[0].cpu()).save('progress.png')# display.display(display.Image('progress.png'))#res = nvidia_smi.nvmlDeviceGetUtilizationRates(handle)#print(f'gpu: {res.gpu}%, gpu-mem: {res.memory}%')def ascend_txt():# global iout = synth(z)
app.py+8-6