Skip to content

Commit

Permalink
Fix startup error on some hardware relating to psutil (#3474)
Browse files Browse the repository at this point in the history
Close #2248. Close #3428

---------
Co-authored-by: Desmond Grealy <k-nearest-neighbour@users.noreply.github.com>
  • Loading branch information
olliestanley authored Jun 14, 2023
1 parent 5e51e7b commit aa272cc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions oasst-shared/oasst_shared/schemas/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ def __init__(self, **data):
data["uname_processor"] = platform.uname().processor
data["cpu_count_physical"] = psutil.cpu_count(logical=False)
data["cpu_count_logical"] = psutil.cpu_count(logical=True)
data["cpu_freq_max"] = psutil.cpu_freq().max
data["cpu_freq_min"] = psutil.cpu_freq().min
try:
data["cpu_freq_max"] = psutil.cpu_freq().max
data["cpu_freq_min"] = psutil.cpu_freq().min
except Exception:
# Workaround for psutil.cpu_freq() throwing exception on some hardware
# or sometimes returning `None`. Hardware affected includes Apple Silicon
# https://github.com/giampaolo/psutil/issues/1892
data["cpu_freq_max"] = 0
data["cpu_freq_min"] = 0
data["mem_total"] = psutil.virtual_memory().total
data["swap_total"] = psutil.swap_memory().total
data["gpus"] = []
Expand Down

0 comments on commit aa272cc

Please sign in to comment.