Skip to content

Commit

Permalink
fix gpu info tab, add nvidia-ml-py
Browse files Browse the repository at this point in the history
  • Loading branch information
rsxdalv committed Oct 3, 2024
1 parent 85a39a4 commit 4ead0e1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ RUN pip3 install --no-cache-dir torch==$TORCH_VERSION -r requirements_styletts2.
RUN pip3 install --no-cache-dir torch==$TORCH_VERSION -r requirements_vall_e.txt
RUN pip3 install --no-cache-dir torch==$TORCH_VERSION -r requirements_maha_tts.txt
RUN pip3 install --no-cache-dir torch==$TORCH_VERSION -r requirements_stable_audio.txt
# RUN pip3 install --no-cache-dir torch==$TORCH_VERSION hydra-core==1.3.2
RUN pip3 install --no-cache-dir torch==$TORCH_VERSION nvidia-ml-py

# Build the React UI
RUN cd react-ui && npm install && npm run build
Expand Down
1 change: 1 addition & 0 deletions installer_scripts/js/initializeApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ async function updateDependencies(optional = true) {
tryInstall("-r requirements_stable_audio.txt", "Stable Audio");
// reinstall hydra-core==1.3.2 because of fairseq
tryInstall("hydra-core==1.3.2", "hydra-core fix due to fairseq");
tryInstall("nvidia-ml-py", "nvidia-ml-py");
savePipPackagesVersion(newPipPackagesVersion);
}

Expand Down
2 changes: 1 addition & 1 deletion installer_scripts/versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.3",
"version": "0.1.0",
"pip_packages": 4,
"npm_packages": 3,
"react_ui": 3
Expand Down
21 changes: 18 additions & 3 deletions tts_webui/utils/gpu_info_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ def get_gpu_info():
return [get_gpu_info_idx(idx) for idx in range(device_count)]


def get_pynvml_fields(idx=0):
# check if pynvml is installed
try:
# import pynvml
return {
"temperature": torch.cuda.temperature(idx),
"power_draw": torch.cuda.power_draw(idx) / 1000,
"utilization": torch.cuda.utilization(idx),
}
# except ImportError:
except:
return {
"temperature": 0,
"power_draw": 0,
"utilization": 0,
}

def get_gpu_info_idx(idx=0):
return {
"torch_version": torch.__version__,
Expand All @@ -43,9 +60,7 @@ def get_gpu_info_idx(idx=0):
"multi_processor_count": torch.cuda.get_device_properties(
idx
).multi_processor_count,
"temperature": torch.cuda.temperature(idx),
"power_draw": torch.cuda.power_draw(idx) / 1000,
"utilization": torch.cuda.utilization(idx),
**get_pynvml_fields(idx),
}


Expand Down

0 comments on commit 4ead0e1

Please sign in to comment.