zokyo.utils.misc module
- zokyo.utils.misc.get_or_set_env(env_var, default_value)[source]
Return either a environment variable or default value for the variable if the value is either None or an empty string.
- zokyo.utils.misc.str_to_random_state(x, first_n=9)[source]
Seed a Numpy random state from a seed
Hashes the string, takes the first N characters of the absolute value of the integer hash result (since numpy random state seeds must be < 2**32-1) and seeds a random state. This allows us to create reproducible random states given a string as input (particularly for data creation).