Created
February 15, 2020 14:53
-
-
Save henry16lin/dce942fdd41df3a633b97c7cdc3368b3 to your computer and use it in GitHub Desktop.
prepare_result
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
# 隨便選一個樣本 | |
sample_idx = 10 | |
# 利用剛剛建立的 Dataset 取出轉換後的 id tensors | |
tokens_tensor, segments_tensor, label_tensor,origin_text = trainset[sample_idx] | |
# 將 tokens_tensor 還原成文本 | |
tokens = tokenizer.convert_ids_to_tokens(tokens_tensor.tolist()) | |
print('token:\n',tokens,'\n') | |
print('origin_text:\n',origin_text,'\n') | |
print('label:',label_map[int(label_tensor.numpy())],'\n') | |
print('tokens_tensor:\n',tokens_tensor,'\n') | |
print('segment tensor:\n',segments_tensor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment