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
gaoqiong
lm-evaluation-harness
Commits
8762b07c
Commit
8762b07c
authored
Jun 28, 2023
by
haileyschoelkopf
Browse files
make self.rank and world_size defaults more robust
parent
9dea125b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lm_eval/api/model.py
lm_eval/api/model.py
+5
-2
No files found.
lm_eval/api/model.py
View file @
8762b07c
...
@@ -12,6 +12,9 @@ class LM(abc.ABC):
...
@@ -12,6 +12,9 @@ class LM(abc.ABC):
(inputs/outputs should be tokenization-agnostic.)
(inputs/outputs should be tokenization-agnostic.)
"""
"""
# set rank and world size to a single process, by default.
self
.
_rank
=
0
self
.
_world_size
=
1
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
loglikelihood
(
self
,
requests
):
def
loglikelihood
(
self
,
requests
):
...
@@ -110,11 +113,11 @@ class LM(abc.ABC):
...
@@ -110,11 +113,11 @@ class LM(abc.ABC):
# used in the case of parallelism. Hardcoded to
# used in the case of parallelism. Hardcoded to
# ensure no errors arise using API models which do
# ensure no errors arise using API models which do
# not support multi-device parallelism nor expect it.
# not support multi-device parallelism nor expect it.
return
0
return
self
.
_rank
@
property
@
property
def
world_size
(
self
):
def
world_size
(
self
):
# used in the case of parallelism. Hardcoded to
# used in the case of parallelism. Hardcoded to
# ensure no errors arise using API models which do
# ensure no errors arise using API models which do
# not support multi-device parallelism nor expect it.
# not support multi-device parallelism nor expect it.
return
1
return
self
.
_world_size
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