| 137 | end |
| 138 | |
| 139 | def test_decode_batch |
| 140 | tokenizer = Tokenizers.from_pretrained("bert-base-cased") |
| 141 | |
| 142 | string_1 = "I can feel the magic, can you?" |
| 143 | token_ids_1 = [101, 146, 1169, 1631, 1103, 3974, 117, 1169, 1128, 136, 102] |
| 144 | |
| 145 | string_2 = "Am I allowed to pass two text arguments?" |
| 146 | token_ids_2 = [101, 7277, 146, 2148, 1106, 2789, 1160, 3087, 9989, 136, 102] |
| 147 | |
| 148 | assert_equal [string_1, string_2], tokenizer.decode_batch([token_ids_1, token_ids_2]) |
| 149 | assert_equal ["[CLS] #{string_1} [SEP]", "[CLS] #{string_2} [SEP]"], tokenizer.decode_batch([token_ids_1, token_ids_2], skip_special_tokens: false) |
| 150 | end |
| 151 | |
| 152 | def test_id_token_conversion |
| 153 | tokenizer = Tokenizers.from_pretrained("bert-base-cased") |
nothing calls this directly
no test coverage detected