Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IM_ShapePlacement
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radhika Yadav
IM_ShapePlacement
Commits
ec4d17d8
Unverified
Commit
ec4d17d8
authored
1 year ago
by
Philipp
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
add cli option to specify instance file name (#52)
parent
8fc8ea05
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
clemgame/benchmark.py
+3
-2
3 additions, 2 deletions
clemgame/benchmark.py
clemgame/clemgame.py
+6
-5
6 additions, 5 deletions
clemgame/clemgame.py
scripts/cli.py
+4
-1
4 additions, 1 deletion
scripts/cli.py
with
13 additions
and
8 deletions
clemgame/benchmark.py
+
3
−
2
View file @
ec4d17d8
...
...
@@ -26,7 +26,8 @@ def list_games():
stdout_logger
.
info
(
"
Game: %s -> %s
"
,
game
.
name
,
game
.
get_description
())
def
run
(
game_name
:
str
,
model_specs
:
List
[
backends
.
ModelSpec
],
gen_args
:
Dict
,
experiment_name
:
str
=
None
):
def
run
(
game_name
:
str
,
model_specs
:
List
[
backends
.
ModelSpec
],
gen_args
:
Dict
,
experiment_name
:
str
=
None
,
instances_name
:
str
=
None
):
if
experiment_name
:
logger
.
info
(
"
Only running experiment: %s
"
,
experiment_name
)
try
:
...
...
@@ -35,7 +36,7 @@ def run(game_name: str, model_specs: List[backends.ModelSpec], gen_args: Dict, e
model
=
backends
.
get_model_for
(
model_spec
)
model
.
set_gen_args
(
**
gen_args
)
# todo make this somehow available in generate method?
player_models
.
append
(
model
)
benchmark
=
load_benchmark
(
game_name
)
benchmark
=
load_benchmark
(
game_name
,
instances_name
=
instances_name
)
logger
.
info
(
"
Running benchmark for
'
%s
'
(models=%s)
"
,
game_name
,
player_models
if
player_models
is
not
None
else
"
see experiment configs
"
)
if
experiment_name
:
...
...
This diff is collapsed.
Click to expand it.
clemgame/clemgame.py
+
6
−
5
View file @
ec4d17d8
...
...
@@ -593,9 +593,10 @@ class GameBenchmark(GameResourceLocator):
"""
raise
NotImplementedError
()
def
setup
(
self
):
# For now, we assume a single instances.json
self
.
instances
=
self
.
load_json
(
"
in/instances.json
"
)
def
setup
(
self
,
instances_name
:
str
=
None
):
if
instances_name
is
None
:
instances_name
=
"
instances
"
self
.
instances
=
self
.
load_json
(
f
"
in/
{
instances_name
}
"
)
def
build_transcripts
(
self
):
results_root
=
file_utils
.
results_root
()
...
...
@@ -907,10 +908,10 @@ def load_benchmarks(do_setup: bool = True) -> List[GameBenchmark]:
return
game_benchmarks
def
load_benchmark
(
game_name
:
str
,
do_setup
:
bool
=
True
)
->
GameBenchmark
:
def
load_benchmark
(
game_name
:
str
,
do_setup
:
bool
=
True
,
instances_name
:
str
=
None
)
->
GameBenchmark
:
gm
=
find_benchmark
(
game_name
)
if
do_setup
:
gm
.
setup
()
gm
.
setup
(
instances_name
)
return
gm
...
...
This diff is collapsed.
Click to expand it.
scripts/cli.py
+
4
−
1
View file @
ec4d17d8
...
...
@@ -59,7 +59,8 @@ def main(args: argparse.Namespace):
benchmark
.
run
(
args
.
game
,
model_specs
=
read_model_specs
(
args
.
models
),
gen_args
=
read_gen_args
(
args
),
experiment_name
=
args
.
experiment_name
)
experiment_name
=
args
.
experiment_name
,
instances_name
=
args
.
instances_name
)
if
args
.
command_name
==
"
score
"
:
benchmark
.
score
(
args
.
game
,
experiment_name
=
args
.
experiment_name
)
if
args
.
command_name
==
"
transcribe
"
:
...
...
@@ -96,6 +97,8 @@ if __name__ == "__main__":
help
=
"
Specify the maximum number of tokens to be generated per turn (except for cohere).
"
"
Be careful with high values which might lead to exceed your API token limits.
"
"
Default: 100.
"
)
run_parser
.
add_argument
(
"
-i
"
,
"
--instances_name
"
,
type
=
str
,
default
=
"
instances
"
,
required
=
True
,
help
=
"
The instances file name (.json suffix will be added automatically.
"
)
score_parser
=
sub_parsers
.
add_parser
(
"
score
"
)
score_parser
.
add_argument
(
"
-e
"
,
"
--experiment_name
"
,
type
=
str
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment