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
OpenDAS
opencompass
Commits
6f07af30
Unverified
Commit
6f07af30
authored
Oct 27, 2023
by
Hubert
Committed by
GitHub
Oct 27, 2023
Browse files
[Feat] Support local runner for windows (#515)
parent
df07391e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
opencompass/runners/local.py
opencompass/runners/local.py
+11
-3
opencompass/tasks/openicl_eval.py
opencompass/tasks/openicl_eval.py
+3
-1
opencompass/tasks/openicl_infer.py
opencompass/tasks/openicl_infer.py
+3
-1
opencompass/utils/menu.py
opencompass/utils/menu.py
+9
-1
No files found.
opencompass/runners/local.py
View file @
6f07af30
...
@@ -146,9 +146,17 @@ class LocalRunner(BaseRunner):
...
@@ -146,9 +146,17 @@ class LocalRunner(BaseRunner):
try
:
try
:
task
.
cfg
.
dump
(
param_file
)
task
.
cfg
.
dump
(
param_file
)
# Build up slurm command
# Build up local command
tmpl
=
'CUDA_VISIBLE_DEVICES='
+
','
.
join
(
str
(
i
)
for
i
in
gpu_ids
)
import
sys
tmpl
+=
' {task_cmd}'
if
sys
.
platform
==
'win32'
:
# Always return win32 for Windows
# use command in Windows format
tmpl
=
'set CUDA_VISIBLE_DEVICES='
+
','
.
join
(
str
(
i
)
for
i
in
gpu_ids
)
tmpl
+=
' & {task_cmd}'
else
:
tmpl
=
'CUDA_VISIBLE_DEVICES='
+
','
.
join
(
str
(
i
)
for
i
in
gpu_ids
)
tmpl
+=
' {task_cmd}'
get_cmd
=
partial
(
task
.
get_command
,
get_cmd
=
partial
(
task
.
get_command
,
cfg_path
=
param_file
,
cfg_path
=
param_file
,
template
=
tmpl
)
template
=
tmpl
)
...
...
opencompass/tasks/openicl_eval.py
View file @
6f07af30
...
@@ -4,6 +4,7 @@ import os.path as osp
...
@@ -4,6 +4,7 @@ import os.path as osp
import
time
import
time
from
collections
import
Counter
from
collections
import
Counter
from
inspect
import
signature
from
inspect
import
signature
from
shutil
import
which
from
typing
import
Optional
from
typing
import
Optional
import
mmengine
import
mmengine
...
@@ -37,7 +38,8 @@ class OpenICLEvalTask(BaseTask):
...
@@ -37,7 +38,8 @@ class OpenICLEvalTask(BaseTask):
def
get_command
(
self
,
cfg_path
,
template
):
def
get_command
(
self
,
cfg_path
,
template
):
script_path
=
__file__
script_path
=
__file__
command
=
f
'python3
{
script_path
}
{
cfg_path
}
'
python
=
'python3'
if
which
(
'python3'
)
else
'python'
command
=
f
'
{
python
}
{
script_path
}
{
cfg_path
}
'
return
template
.
format
(
task_cmd
=
command
)
return
template
.
format
(
task_cmd
=
command
)
def
run
(
self
):
def
run
(
self
):
...
...
opencompass/tasks/openicl_infer.py
View file @
6f07af30
...
@@ -2,6 +2,7 @@ import argparse
...
@@ -2,6 +2,7 @@ import argparse
import
os.path
as
osp
import
os.path
as
osp
import
random
import
random
import
time
import
time
from
shutil
import
which
from
typing
import
Any
from
typing
import
Any
from
mmengine.config
import
Config
,
ConfigDict
from
mmengine.config
import
Config
,
ConfigDict
...
@@ -48,7 +49,8 @@ class OpenICLInferTask(BaseTask):
...
@@ -48,7 +49,8 @@ class OpenICLInferTask(BaseTask):
f
'--nproc_per_node
{
self
.
num_procs
}
'
f
'--nproc_per_node
{
self
.
num_procs
}
'
f
'
{
script_path
}
{
cfg_path
}
'
)
f
'
{
script_path
}
{
cfg_path
}
'
)
else
:
else
:
command
=
f
'python
{
script_path
}
{
cfg_path
}
'
python
=
'python3'
if
which
(
'python3'
)
else
'python'
command
=
f
'
{
python
}
{
script_path
}
{
cfg_path
}
'
return
template
.
format
(
task_cmd
=
command
)
return
template
.
format
(
task_cmd
=
command
)
...
...
opencompass/utils/menu.py
View file @
6f07af30
import
curses
import
sys
if
sys
.
platform
==
'win32'
:
# Always return win32 for Windows
# curses is not supported on Windows
# If you want to use this function in Windows platform
# you can try `windows_curses` module by yourself
curses
=
None
else
:
import
curses
class
Menu
:
class
Menu
:
...
...
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