diff --git a/ppdet/data/shm_utils.py b/ppdet/data/shm_utils.py index 38d8ba66cd71baa169c27a44e59a1d4d908b8d7c..a929a809cec9bc1e6b1dd335faa0ba4f2e44ff87 100644 --- a/ppdet/data/shm_utils.py +++ b/ppdet/data/shm_utils.py @@ -34,7 +34,10 @@ SHM_DEFAULT_MOUNT = '/dev/shm' def _parse_size_in_M(size_str): - num, unit = size_str[:-1], size_str[-1] + if size_str[-1] == 'B': + num, unit = size_str[:-2], size_str[-2] + else: + num, unit = size_str[:-1], size_str[-1] assert unit in SIZE_UNIT, \ "unknown shm size unit {}".format(unit) return float(num) * \