Command Line Interface
AIF-Gen is intended to be primarily used as a command line tool:
foo@bar:~$ aif --help
/ _ | / _/ __/ / ___/ __/ |/ /
/ __ |_/ // _/ / (_ / _// /
/_/ |_/___/_/ \___/___/_/|_/
A tool for generating synthetic continual RLHF datasets.
Usage: aif [OPTIONS] COMMAND [ARGS]...
Options:
--log_file FILE Optional log file to use. [default: aif_gen.log]
--help Show this message and exit.
Commands:
generate Generate a new ContinualAlignmentDataset.
merge Merge a set of ContinualAlignmentDatasets.
preview Preview a ContinualAlignmentDataset.
sample Downsample a ContinualAlignmentDataset.
transform Transform a ContinualAlignmentDataset.
validate Validate a ContinualAlignmentDataset.
generate
generate(
data_config_name: Path,
model: str,
output_file: Path,
max_concurrency: int,
max_tokens_prompt_response: int,
max_tokens_chosen_rejected_response: int,
random_seed: int,
dry_run: bool,
hf_repo_id: Optional[str],
include_preference_axes: bool,
temperature: float,
) -> None
Generate a new ContinualAlignmentDataset.
DATA_CONFIG_NAME: Path to the dataset configuration file to use for dataset generation. MODEL: vLLM-compatible model to use for data generation.
Source code in aif_gen/cli/commands/generate.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
merge
merge() -> None
Merge a set of ContinualAlignmentDatasets.
Source code in aif_gen/cli/commands/merge.py
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 41 42 43 44 45 46 47 48 49 50 | |
preview
Preview a ContinualAlignmentDataset.
INPUT_DATA_FILE: Path to the input dataset.
Source code in aif_gen/cli/commands/preview.py
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
sample
sample(
input_data_file: Path,
keep_ratio_train: float,
keep_ratio_test: float,
keep_amount_train: Optional[int],
keep_amount_test: Optional[int],
hf_repo_id: Optional[str],
hf_repo_id_out: Optional[str],
output_file: Path,
random_seed: int,
) -> None
Downsample a ContinualAlignmentDataset.
INPUT_DATA_FILE: Path to the input dataset. KEEP_RATIO_TRAIN: Ratio of samples to keep in the train dataset. KEEP_RATIO_TEST: Ratio of samples to keep in the test dataset.
Source code in aif_gen/cli/commands/sample.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
transform
Functions:
-
preference_swap–Swap the 'chosen' and 'rejected' responses for each sample in the dataset with probability.
-
split–Split a ContinualAlignmentDataset into train and test datasets.
-
transform–Transform a ContinualAlignmentDataset.
preference_swap
preference_swap(
input_data_file: Path,
output_data_file: Path,
p: float,
hf_repo_id: Optional[str],
hf_repo_id_out: Optional[str],
random_seed: int,
) -> None
Swap the 'chosen' and 'rejected' responses for each sample in the dataset with probability.
INPUT_DATA_FILE: Path to the input dataset. OUTPUT_DATA_FILE: Path to the output (transformed) dataset.
Source code in aif_gen/cli/commands/transform.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
split
split(
input_data_file: Path,
hf_repo_id: Optional[str],
hf_repo_id_out: Optional[str],
output_file: Path,
test_sample_ratio: float,
random_seed: int,
) -> None
Split a ContinualAlignmentDataset into train and test datasets.
INPUT_DATA_FILE: Path to the input dataset.
Source code in aif_gen/cli/commands/transform.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
transform
transform() -> None
Transform a ContinualAlignmentDataset.
Source code in aif_gen/cli/commands/transform.py
16 17 18 | |
validate
validate(
input_data_file: Path,
output_validation_file: Path,
validate_count: bool,
validate_entropy: bool,
validate_llm_judge: bool,
validate_embedding_diversity: bool,
model: str,
embedding_model: str,
embedding_batch_size: int,
max_concurrency: int,
max_tokens_judge_response: int,
dry_run: bool,
hf_repo_id: Optional[str],
random_seed: int,
) -> None
Validate a ContinualAlignmentDataset.
INPUT_DATA_FILE: Path to the input dataset. OUTPUT_VALIDATION_FILE: Path to the output validation file.
Source code in aif_gen/cli/commands/validate.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |