Explorar el Código

Fix typos with codespell (#126)

Max Ryabinin hace 2 años
padre
commit
3ca8b4f082

+ 1 - 1
README.md

@@ -140,7 +140,7 @@ The automated tests use a more complex server configuration that can be found [h
 ### Code style
 ### Code style
 
 
 We use [black](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html) and [isort](https://pycqa.github.io/isort/) for all pull requests.
 We use [black](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html) and [isort](https://pycqa.github.io/isort/) for all pull requests.
-Before commiting your code, simply run `black . && isort .` and you will be fine.
+Before committing your code, simply run `black . && isort .` and you will be fine.
 
 
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
 
 

+ 1 - 1
src/petals/bloom/ops.py

@@ -116,7 +116,7 @@ def dropout_add(x, residual, prob, training):
     Args:
     Args:
         x (`torch.tensor`, *required*):
         x (`torch.tensor`, *required*):
             input tensor
             input tensor
-        residual (`torch.tensor`, *rquired*):
+        residual (`torch.tensor`, *required*):
             esidual tensor
             esidual tensor
         prob (`float`, *required*):
         prob (`float`, *required*):
             dropout probability
             dropout probability

+ 2 - 2
src/petals/client/inference_session.py

@@ -84,14 +84,14 @@ class _ServerInferenceSession:
         """
         """
         Inference step: send a chunk of input tesors and receive a chunk of outputs
         Inference step: send a chunk of input tesors and receive a chunk of outputs
         :prompts: optional DEEP prompts, added to a prefix of each layer's outputs,
         :prompts: optional DEEP prompts, added to a prefix of each layer's outputs,
-          if specified, deep promts should have shape [num_layers, batch_size, prefix_len, hid_size]
+          if specified, deep prompts should have shape [num_layers, batch_size, prefix_len, hid_size]
         """
         """
         if self.closed:
         if self.closed:
             raise Exception("Session is closed, cannot perform step")
             raise Exception("Session is closed, cannot perform step")
         if prompts is None or is_dummy(prompts):
         if prompts is None or is_dummy(prompts):
             prompts = DUMMY
             prompts = DUMMY
         else:
         else:
-            assert prompts.ndim == 4, "deep promts should have shape [num_layers, batch_size, prefix_len, hid_size]"
+            assert prompts.ndim == 4, "deep prompts should have shape [num_layers, batch_size, prefix_len, hid_size]"
             assert prompts.shape[0] == self.num_blocks
             assert prompts.shape[0] == self.num_blocks
             assert prompts.shape[1] in (new_hidden_states.shape[0], 1)
             assert prompts.shape[1] in (new_hidden_states.shape[0], 1)
             assert prompts.shape[2] <= new_hidden_states.shape[1]
             assert prompts.shape[2] <= new_hidden_states.shape[1]

+ 2 - 2
src/petals/client/routing/sequence_manager.py

@@ -35,7 +35,7 @@ class RemoteSequenceManager:
     :param block_uids: a sequence of DHT keys (strings) corresponding to remote layers
     :param block_uids: a sequence of DHT keys (strings) corresponding to remote layers
     :param p2p: an optional P2P replica (if not specified, create one via dht.replicate_p2p())
     :param p2p: an optional P2P replica (if not specified, create one via dht.replicate_p2p())
     :param update_period: by default, refresh DHT information once in this many seconds
     :param update_period: by default, refresh DHT information once in this many seconds
-    :param request_timeout: float, in seconds, default timeout for RPC forwad/backward/inference requests
+    :param request_timeout: float, in seconds, default timeout for RPC forward/backward/inference requests
     :param min_backoff: after a repeated failure, sleep for this many seconds times 2 ^ (num_failures - 1)
     :param min_backoff: after a repeated failure, sleep for this many seconds times 2 ^ (num_failures - 1)
     :param sequence_info: optionally, specify pre-generated sequence info. by default, create a new one using dht
     :param sequence_info: optionally, specify pre-generated sequence info. by default, create a new one using dht
     :param rpc_info: optionally, specify rpc info (communicated tensor shapes and compression) to save time
     :param rpc_info: optionally, specify rpc info (communicated tensor shapes and compression) to save time
@@ -207,7 +207,7 @@ class RemoteSequenceManager:
     def get_request_metadata(self, protocol: str, *args, **kwargs) -> Optional[Dict[str, Any]]:
     def get_request_metadata(self, protocol: str, *args, **kwargs) -> Optional[Dict[str, Any]]:
         """
         """
         :param protocol: one of "rpc_forward", "rpc_backward" or "rpc_inference"
         :param protocol: one of "rpc_forward", "rpc_backward" or "rpc_inference"
-        :param args: request-specific inputs, typicall block uids and input tensors
+        :param args: request-specific inputs, typically block uids and input tensors
         :param kwargs: additional request context, such as remote peer ID
         :param kwargs: additional request context, such as remote peer ID
         :returns: msgpack-serialized metadata dict that will be passed alongside a given request
         :returns: msgpack-serialized metadata dict that will be passed alongside a given request
         """
         """

+ 2 - 2
src/petals/dht_utils.py

@@ -33,7 +33,7 @@ def declare_active_modules(
     :param uids: a list of module ids to declare
     :param uids: a list of module ids to declare
     :param wait: if True, awaits for declaration to finish, otherwise runs in background
     :param wait: if True, awaits for declaration to finish, otherwise runs in background
     :param throughput: specify your performance in terms of compute throughput
     :param throughput: specify your performance in terms of compute throughput
-    :param expiration_time: declated modules will be visible for this many seconds
+    :param expiration_time: declared modules will be visible for this many seconds
     :returns: if wait, returns store status for every key (True = store succeeded, False = store rejected)
     :returns: if wait, returns store status for every key (True = store succeeded, False = store rejected)
     """
     """
     if isinstance(uids, str):
     if isinstance(uids, str):
@@ -107,7 +107,7 @@ def get_remote_module(
 ) -> Union[Union[petals.client.RemoteTransformerBlock, List[petals.client.RemoteTransformerBlock]], MPFuture]:
 ) -> Union[Union[petals.client.RemoteTransformerBlock, List[petals.client.RemoteTransformerBlock]], MPFuture]:
     """
     """
     :param uid_or_uids: find one or more modules with these ids from across the DHT
     :param uid_or_uids: find one or more modules with these ids from across the DHT
-    :param config: model config, usualy taken by .from_pretrained(MODEL_NAME)
+    :param config: model config, usually taken by .from_pretrained(MODEL_NAME)
     :param return_future: if False (default), return when finished. Otherwise return MPFuture and run in background.
     :param return_future: if False (default), return when finished. Otherwise return MPFuture and run in background.
     :returns: a list of [RemoteTransformerBlock]
     :returns: a list of [RemoteTransformerBlock]
     """
     """

+ 2 - 2
src/petals/server/server.py

@@ -173,7 +173,7 @@ class Server:
     def _choose_num_blocks(self) -> int:
     def _choose_num_blocks(self) -> int:
         assert (
         assert (
             self.converted_model_name_or_path == "bigscience/bloom-petals"
             self.converted_model_name_or_path == "bigscience/bloom-petals"
-        ), "If you use a model other than bigscience/bloom-petals, please specify --num blocks manually"
+        ), "If you use a model other than bigscience/bloom-petals, please specify --num_blocks manually"
         assert self.device.type == "cuda", "If you run a non-GPU server, please specify --num_blocks manually"
         assert self.device.type == "cuda", "If you run a non-GPU server, please specify --num_blocks manually"
 
 
         gib = 1024**3
         gib = 1024**3
@@ -497,7 +497,7 @@ class ModuleContainer(threading.Thread):
         logger.debug(f"Shutting down runtime")
         logger.debug(f"Shutting down runtime")
         self.runtime.shutdown()
         self.runtime.shutdown()
 
 
-        logger.info("Module container shut down succesfully")
+        logger.info("Module container shut down successfully")
 
 
 
 
 class ModuleAnnouncerThread(threading.Thread):
 class ModuleAnnouncerThread(threading.Thread):

+ 2 - 2
src/petals/server/task_prioritizer.py

@@ -4,11 +4,11 @@ import torch
 
 
 
 
 class TaskPrioritizerBase(ABC):
 class TaskPrioritizerBase(ABC):
-    """Abstract class for TaskPrioritizer whose reponsibility is to evaluate task priority"""
+    """Abstract class for TaskPrioritizer whose responsibility is to evaluate task priority"""
 
 
     @abstractmethod
     @abstractmethod
     def prioritize(self, *input: torch.Tensor, points: float = 0.0, **kwargs) -> float:
     def prioritize(self, *input: torch.Tensor, points: float = 0.0, **kwargs) -> float:
-        """Evaluates task value by the amout of points given, task input and additional kwargs. Lower priority is better"""
+        """Evaluates task value by the amount of points given, task input and additional kwargs. Lower priority is better"""
         pass
         pass
 
 
 
 

+ 1 - 1
src/petals/utils/generation_algorithms.py

@@ -25,7 +25,7 @@ class DecodingAlgorithm(ABC):
 
 
 class GreedyAlgorithm(DecodingAlgorithm):
 class GreedyAlgorithm(DecodingAlgorithm):
     """
     """
-    The simpliest algorithm for decoding. It selects the most probable token.
+    The simplest algorithm for decoding. It selects the most probable token.
     """
     """
 
 
     def __call__(self, logits: torch.Tensor) -> Tuple[TokenIds, HypoIds]:
     def __call__(self, logits: torch.Tensor) -> Tuple[TokenIds, HypoIds]:

+ 1 - 1
src/petals/utils/generation_constraints.py

@@ -14,7 +14,7 @@ class ABCBloomConstraint(ABC):
     def __call__(self, tokens_id: torch.Tensor, logits: torch.Tensor, hypo_ids: torch.Tensor) -> torch.Tensor:
     def __call__(self, tokens_id: torch.Tensor, logits: torch.Tensor, hypo_ids: torch.Tensor) -> torch.Tensor:
         """
         """
         This method is called by the decoding algorithm to apply the constraint. It changes and returns new logits.
         This method is called by the decoding algorithm to apply the constraint. It changes and returns new logits.
-        :param tokens_id: The token id of the last choosen token.
+        :param tokens_id: The token id of the last chosen token.
         :param logits: The logits from the Bloom model.
         :param logits: The logits from the Bloom model.
         :param hypo_ids: The hypothesis ids of the last tokens.
         :param hypo_ids: The hypothesis ids of the last tokens.
         """
         """