Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ox696c
ktransformers
Commits
433ddd70
Commit
433ddd70
authored
Aug 24, 2025
by
ox696c
Browse files
Update utils.py
parent
45599737
Pipeline
#2898
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
ktransformers/util/utils.py
ktransformers/util/utils.py
+12
-0
No files found.
ktransformers/util/utils.py
View file @
433ddd70
...
@@ -33,6 +33,18 @@ import socket
...
@@ -33,6 +33,18 @@ import socket
warm_uped
=
False
warm_uped
=
False
def
get_device_name
(
device
:
torch
.
device
=
None
):
if
torch
.
cuda
.
is_available
():
if
device
is
None
:
num_gpus
=
torch
.
cuda
.
device_count
()
gpu_name
=
[]
for
gpu_id
in
range
(
num_gpus
):
gpu_name
.
append
(
torch
.
cuda
.
get_device_name
(
gpu_id
))
return
gpu_name
else
:
return
torch
.
cuda
.
get_device_name
(
device
)
def
get_free_ports
(
n
:
int
,
continue_prot
:
list
):
def
get_free_ports
(
n
:
int
,
continue_prot
:
list
):
sockets
=
[]
sockets
=
[]
ports
=
[]
ports
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment