Commit 8762b07c authored by haileyschoelkopf's avatar haileyschoelkopf
Browse files

make self.rank and world_size defaults more robust

parent 9dea125b
......@@ -12,6 +12,9 @@ class LM(abc.ABC):
(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
def loglikelihood(self, requests):
......@@ -110,11 +113,11 @@ class LM(abc.ABC):
# used in the case of parallelism. Hardcoded to
# ensure no errors arise using API models which do
# not support multi-device parallelism nor expect it.
return 0
return self._rank
@property
def world_size(self):
# used in the case of parallelism. Hardcoded to
# ensure no errors arise using API models which do
# not support multi-device parallelism nor expect it.
return 1
return self._world_size
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment