Command Line Options

Command line options may be specified in either a config file or directly passed as flags. If an option exists in both the config file and flags, flags take precedent and override the config file.

The config file is a yaml file, examples may be found in example_config. In the config file, each key-value pair key: value corresponds to passing the flag --key value. The following example sets the training data path in the config file

training_file: path/to/data

For an option with multiple values, it can be specified as a list

monitor_metrics: [P@1, P@3, P@5]

The corresponding command line flag is passed as

python3 main.py --monitor_metrics P@1 P@3 P@5

For options such as liblinear_options, the value may contain -. Use = to pass the value on the command line

python3 main.py --liblinear_options='-s 2 -B 1 -e 0.0001 -q'

Second-level parameters such as those under``network_config`` must be specified in a config file.

List of Options

Name

Description

-c --config

Path to configuration file.

--result_dir

The directory to save checkpoints and logs (default: ./runs).

--data_name

Dataset name (default: unnamed_data).

--training_file

Path to training data (default: None).

--val_file

Path to validation data (default: None).

--test_file

Path to test data (default: None.

--val_size

Training-validation split: a ratio in [0, 1] or an integer for the size of the validation set (default: 0.2)..

--min_vocab_freq

The minimum frequency needed to include a token in the vocabulary (default: 1).

--max_seq_length

The maximum number of tokens of a sample (default: 500).

--shuffle

Whether to shuffle training data before each epoch (default: True).

--merge_train_val

Whether to merge the training and validation data. (default: None).

--include_test_labels

Whether to include labels in the test dataset. (default: None).

--remove_no_label_data

Whether to remove training and validation instances that have no labels. (default: None).

--add_special_tokens

Whether to add the special tokens for inputs of the transformer-based language model. (default: True).

--seed

Random seed (default: None).

--epochs

The number of epochs to train (default: 10000).

--batch_size

Size of training batches (default: 16).

--optimizer

Optimizer (default: adam). One of {adam, adamw, adamax, sgd}.

--learning_rate

Learning rate for optimizer (default: 0.0001).

--weight_decay

Weight decay factor (default: 0).

--momentum

Momentum factor for SGD only (default: 0.9).

--lr_scheduler

Name of the learning rate scheduler (default: None).

--patience

The number of epochs to wait for improvement before early stopping (default: 5).

--early_stopping_metric

The metric to monitor for early stopping. Set to val_metric if specified as None. (default: None).

--normalize_embed

Whether the embeddings of each word is normalized to a unit vector (default: None).

--model_name

Model to be used (default: unnamed_model).

--init_weight

Weight initialization to be used (default: kaiming_uniform).

--loss_function

Loss function (default: binary_cross_entropy_with_logits).

--eval_batch_size

Size of evaluating batches (default: 256).

--metric_threshold

The decision value threshold over which a label is predicted as positive (default: 0.5).

--monitor_metrics

Metrics to monitor for evaluation (default: [‘P@1’, ‘P@3’, ‘P@5’]).

--val_metric

The metric to select the best model for testing (default: P@1).

--vocab_file

Path to a file holding vocabuaries (default: None).

--embed_file

Path to a file holding pre-trained embeddings (default: None).

--label_file

Path to a file holding all labels (default: None).

--save_k_predictions

Save top k predictions on test set. k=100 if not specified. (default: 0).

--predict_out_path

Path to the output file holding label results (default: ./predictions.txt).

--limit_train_batches

Percentage of train dataset to use for auto-testing (default: 1.0).

--limit_val_batches

Percentage of validation dataset to use for auto-testing (default: 1.0).

--limit_test_batches

Percentage of test dataset to use for auto-testing (default: 1.0).

--cpu

Disable CUDA.

--silent

Enable silent mode.

--data_workers

Use multi-cpu core for data pre-processing (default: 4).

--embed_cache_dir

For parameter search only: path to a directory for storing embeddings for multiple runs. (default: None).

--eval

Only run evaluation on the test set (default: None).

--checkpoint_path

The checkpoint to warm-up with (default: None).

--linear

Train linear model.

--data_format

‘svm’ for SVM format or ‘txt’ for LibMultiLabel format (default: txt).

--liblinear_options

Options passed to liblinear (default: None).

--linear_technique

Technique for linear classification (default: 1vsrest). One of {1vsrest, thresholding, cost_sensitive, cost_sensitive_micro, binary_and_multiclass, tree}.

--save_positive_predictions

Save all the predictions with decision value larger then 0. If used, the save_k_predictions must be set to 0.

--tree_degree

Degree of the tree (default: 100).

--tree_max_depth

Maximum depth of the tree (default: 10).

--beam_width

The width of the beam search (default: 10).

--cluster_size

the maximal number of labels inside a cluster (default: 8).

-h --help

If you are trying to specify network config such as dropout or activation or config of the learning rate scheduler, use a yaml file instead. See example configs in example_config.