Util
Utilities
seed
Functions:
-
seed_everything–Sets the seed for generating random number in Pytorch, numpy and Python.
seed_everything
seed_everything(seed: int) -> None
Sets the seed for generating random number in Pytorch, numpy and Python.
Parameters:
-
seed(int)–The desired seed.
Source code in aif_gen/util/seed.py
7 8 9 10 11 12 13 14 15 16 17 | |
hf
Functions:
-
download_from_hf–Download a remote HuggingFace dataset to the local file system.
-
upload_to_hf–Upload a local dataset to a remote HuggingFace repository.
download_from_hf
Download a remote HuggingFace dataset to the local file system.
Parameters:
-
repo_id(str) –The name of the HuggingFace dataset repository.
-
filename(Union[str,(pathlib.Path]) –Remote path to download.
Returns:
-
Path–Absolute path on the local filesystem where the data was downloaded.
Note: Assumes the client is authenticated.
Source code in aif_gen/util/hf.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
upload_to_hf
Upload a local dataset to a remote HuggingFace repository.
Parameters:
-
repo_id(str) –The name of the HuggingFace dataset repository.
-
local_path(Union[str, Path]) –Local path to upload, either a single file, or directory.
Note: Assumes the client is authenticated.
Source code in aif_gen/util/hf.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |