MEDTOK is a multimodal tokenizer of medical codes that combines text descriptions of codes with graph-based representations of dependencies between codes derived from clinical ontologies and standard medical terminologies. MEDTOK is a general-purpose tokenizer that can be integrated into any transformer-based model or system that requires tokenization.
1from transformers import AutoTokenizer
2tokenizer = AutoTokenizer.from_pretrained("mims-harvard/MedTok", trust_remote_code=True)
3tokens = tokenizer("E11.9")
4embed = tokenizer.embed("E11.9")
If you want to use the tokenized embedding for each medical code, please download it from
mims-harvard/MedTok or
code2embeddings.json.zip directly. And the downloaded embedding file could be put into 'MedTok/embedding.npy' to run EHR or QA tasks based on MedTok.
Please reference our github repo
MedTok
MedTok tokenizer V1.0 now only supports those medical codes adopted in our paper. For those unseen codes, the output will be '' token. We will also continue to update our MedTok to make it apply to more coding system and tokenize medical code dynamically.
1@article{su2025multimodal,
2 title={Multimodal Medical Code Tokenizer},
3 author={Su, Xiaorui and Messica, Shvat and Huang, Yepeng and Johnson, Ruth and Fesser, Lukas and Gao, Shanghua and Sahneh, Faryad and Zitnik, Marinka},
4 journal={International Conference on Machine Learning, ICML},
5 year={2025}
6}
Thank you for your support!
If you have any questions or suggestions, please email
Xiaorui Su and
Marinka Zitnik.