<jupyter_start><jupyter_text>1. Generate datasets<jupyter_code>train_dataset, valid_dataset, test_dataset = get_SLU_datasets(config)
#train_dataset_sample = next(iter(train_dataset.loader))
config.Sy_intent<jupyter_output><empty_output><jupyter_text>2. Train SLU Model<jupyter_code># Initialize SLU Model
model = Model(config=config)
model
%%time

# Train the model
trainer = Trainer(model=model, config=config)
# if restart: trainer.load_checkpoint()

for epoch in range(config.training_num_epochs):
    print("========= Epoch %d of %d =========" % (epoch+1, config.training_num_epochs))
    train_intent_acc, train_intent_loss = trainer.train(train_dataset)
    valid_intent_acc, valid_intent_loss = trainer.test(valid_dataset)

    print("========= Results: epoch %d of %d =========" % (epoch+1, config.training_num_epochs))
    print("*intents*| train accuracy: %.2f| train loss: %.2f| valid accuracy: %.2f| valid loss: %.2f\n" % (train_intent_acc, train_intent_loss, valid_intent_acc, valid_intent_loss) )
    
    trainer.save_checkpoint()<jupyter_output>0%|          | 0/723 [00:00<?, ?it/s]<jupyter_text>3. Evaluate the Model<jupyter_code>test_intent_acc, test_intent_loss = trainer.test(test_dataset)
print("========= Test results =========")
print("*intents*| test accuracy: %.2f| test loss: %.2f| valid accuracy: %.2f| valid loss: %.2f\n" % (test_intent_acc, test_intent_loss, valid_intent_acc, valid_intent_loss) )<jupyter_output>========= Test results =========
*intents*| test accuracy: 0.99| test loss: 0.05| valid accuracy: 0.93| valid loss: 0.40
{'fraction_non_alphanumeric': 0.16901408450704225, 'fraction_numerical': 0.02176696542893726, 'mean_word_length': 6.661764705882353, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '560259', 'license': 'Apache-2.0', 'n_tokens_mistral': 563, 'n_tokens_neox': 552, 'n_words': 115, 'path': '2_train.ipynb', 'repo_name': 'daydrill/end-to-end-SLU-langcon2020', 'size': '1562'}