Created
November 10, 2019 12:35
-
-
Save sobamchan/5141da606662b30a7b2464473b823150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def training_step(self, batch, batch_idx): | |
labels = batch["label"] | |
input_ids = batch["input_ids"] | |
attention_mask = batch["attention_mask"] | |
token_type_ids = batch["token_type_ids"] | |
loss, _ = self.model( | |
input_ids, | |
token_type_ids=token_type_ids, | |
attention_mask=attention_mask, | |
labels=labels | |
) | |
tqdm_dict = {"train_loss": loss} | |
output = OrderedDict({ | |
"loss": loss, | |
"progress_bar": tqdm_dict, | |
"log": tqdm_dict | |
}) | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment