From 9f2076b4b3851f11f5ca36f27af725236d75b1c5 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Thu, 25 Jul 2024 22:23:36 +0800 Subject: [PATCH] fix rocminfo error --- koboldcpp.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 0458d7b0e..dc4d5f785 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -675,16 +675,18 @@ def fetch_gpu_properties(testCL,testCU,testVK): elif line.startswith("Device Type:") and "GPU" not in line: device_name = None if FetchedCUdevices: getamdvram = subprocess.run(['rocm-smi', '--showmeminfo', 'vram', '--csv'], capture_output=True, text=True, check=True, encoding='utf-8').stdout # fetch VRAM of devices - FetchedCUdeviceMem = [line.split(",")[1].strip() for line in getamdvram.splitlines()[1:] if line.strip()] + if getamdvram: + FetchedCUdeviceMem = [line.split(",")[1].strip() for line in getamdvram.splitlines()[1:] if line.strip()] except Exception as e: pass for idx in range(0,4): if(len(FetchedCUdevices)>idx): CUDevicesNames[idx] = FetchedCUdevices[idx] - if AMDgpu: - MaxMemory[0] = max(int(FetchedCUdeviceMem[idx]),MaxMemory[0]) - else: - MaxMemory[0] = max(int(FetchedCUdeviceMem[idx])*1024*1024,MaxMemory[0]) + if len(FetchedCUdeviceMem)>idx: + if AMDgpu: + MaxMemory[0] = max(int(FetchedCUdeviceMem[idx]),MaxMemory[0]) + else: + MaxMemory[0] = max(int(FetchedCUdeviceMem[idx])*1024*1024,MaxMemory[0]) if testVK: try: # Get Vulkan names