Download fengshen/data/data_utils/common_utils.py from fclong/summary: direct link, hf CLI and curl.
- Browser
- Download file 180 Bytes
-
https://huggingface.co/spaces/fclong/summary/resolve/main/fengshen/data/data_utils/common_utils.py
- Command line
-
hf download hf://spaces/fclong/summary/fengshen/data/data_utils/common_utils.py
-
curl -L -o common_utils.py https://huggingface.co/spaces/fclong/summary/resolve/main/fengshen/data/data_utils/common_utils.py
180 Bytes
| def padding_to_maxlength(ids, max_length, pad_id): | |
| cur_len = len(ids) | |
| len_diff = max_length - len(ids) | |
| return ids + [pad_id] * len_diff, [1] * cur_len + [0] * len_diff | |