Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created July 17, 2020 17:03
Show Gist options
  • Save prateekjoshi565/f8dde394ac17632499a9a68080ec7a7f to your computer and use it in GitHub Desktop.
Save prateekjoshi565/f8dde394ac17632499a9a68080ec7a7f to your computer and use it in GitHub Desktop.
## convert lists to tensors
train_seq = torch.tensor(tokens_train['input_ids'])
train_mask = torch.tensor(tokens_train['attention_mask'])
train_y = torch.tensor(train_labels.tolist())
val_seq = torch.tensor(tokens_val['input_ids'])
val_mask = torch.tensor(tokens_val['attention_mask'])
val_y = torch.tensor(val_labels.tolist())
test_seq = torch.tensor(tokens_test['input_ids'])
test_mask = torch.tensor(tokens_test['attention_mask'])
test_y = torch.tensor(test_labels.tolist())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment