Skip to content

Commit 7311279

Browse files
committed
Transformer integration (update)
1 parent 0c0fcfa commit 7311279

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

examples/slm_advanced_train_ex.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ namespace dlib
165165
template<bool is_training>
166166
using network_type = std::conditional_t<is_training,
167167
classification_head<VOCAB_SIZE,
168-
projection_head<activation_func, 4, EMBEDDING_DIM,
168+
projection_head<activation_func, 2, EMBEDDING_DIM,
169169
repeat<NUM_LAYERS, t_transformer_block,
170170
token_embeddings<dropout_policy, VOCAB_SIZE, EMBEDDING_DIM, input<matrix<int, 0, 1>>>>>>,
171171
classification_head<VOCAB_SIZE,
172-
projection_head<activation_func, 4, EMBEDDING_DIM,
172+
projection_head<activation_func, 2, EMBEDDING_DIM,
173173
repeat<NUM_LAYERS, i_transformer_block,
174174
token_embeddings<multiply, VOCAB_SIZE, EMBEDDING_DIM, input<matrix<int, 0, 1>>>>>>>;
175175

@@ -503,7 +503,7 @@ int main(int argc, char** argv)
503503
const std::string model_file = get_option(parser, "model-file", "data_model.dat");
504504
const std::string output_file = get_option(parser, "output-file", "data_generated.txt");
505505
const std::string data_path = get_option(parser, "data", "data.txt");
506-
const long max_seq_len = 30;
506+
const long max_seq_len = 50;
507507
const long num_layers = 4;
508508
const long num_heads = 6;
509509
const long embedding_dim = 228;
@@ -737,7 +737,7 @@ int main(int argc, char** argv)
737737
// Build and train the network
738738
using net_type = my_transformer::network_type<true>;
739739
net_type net;
740-
cout << "Model architecture:\n" << my_transformer::model_info::describe() << endl;
740+
cout << my_transformer::model_info::describe() << endl;
741741
if (file_exists(model_file)) deserialize(model_file) >> net;
742742

743743
// Create trainer

0 commit comments

Comments
 (0)