This is the offical implementation of the paper "QNet: A Quantum-native Transformer Encoder Architecture".
To train a new model, run the trainer with customized configuration.
python train.py [-h] [--dataset DATASET] [--model MODEL] [--seq_len SEQ_LEN]
[--embed_size EMBED_SIZE] [--num_blocks NUM_BLOCKS]
[--batch_size BATCH_SIZE] [--lr LR]
[--epochs EPOCHS]
Configurable training arguments:
options | explanation |
---|---|
-h | show help message |
-d DATASET | Select the training dataset. (default: stackoverflow) |
-m MODEL | Select the trainig model (transformer, qnet, fnet) (default: qnet) |
-ml SEQ_LEN | Input length for the model. (default: 8) |
-ed EMBED_SIZE | Embedding size for each token. (default: 2) |
-nb NUM_BLOCKS | Number of mini-blocks in the model. (default: 1) |
-bs BATCH_SIZE | Number of samples per batch a node. (default: 128) |
-lr LR | The initial learning rate. (default: 3e-4) |
-e EPOCHS | Number of training loops over all training data. (default: 5) |
The script to train the model in the distributed environment is in scripts/
directory.
Configurable arguments for distributed training:
options | explanation |
---|---|
--num_nodes NUM_NODES | The number of computing nodes. |
--pbs_log_file LOG_FILE | The path to store the log file. |
--notification_email NOTIFICATION_EMAIL | The job status will be sent to this email. |