From 4526338549774728af40c9b07bab27a3461c3bff Mon Sep 17 00:00:00 2001 From: "baodong.lh" Date: Fri, 3 Jan 2025 17:06:23 +0800 Subject: [PATCH] fix empty lines --- chatlearn/utils/dist_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chatlearn/utils/dist_utils.py b/chatlearn/utils/dist_utils.py index ed85128..d78972c 100644 --- a/chatlearn/utils/dist_utils.py +++ b/chatlearn/utils/dist_utils.py @@ -18,12 +18,15 @@ import torch from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors + def bucket_tensors(tensors, bucket_size_mb): """Group tensors into chunks. We seperate sparse and dense tensor, each containing tensors of same type up to certain byte limit in total size. + Args: tensors (Sequence): A sequence of tensors to be separated into chunks. size_limit (int): The limit of each chunk in bytes. + Return: dense_buckets: Blocks of tensors of same type and within size_limit. sparse_bucket: A list of sparse tensors