def METHOD_NAME(model_type, maxlen, attend_to_mask_tokens):
    model_dir = None
    # if it is a directory, load json file to get the model type
    if os.path.isdir(model_type):
        model_dir = model_type
        json_file = model_type + '/config.json'
        print_message(f"json file (get_query_tokenizer): {json_file}")
        with open(json_file) as file:
            data = json.load(file)
        model_type = data["_name_or_path"]
    print_message(f"get query model type: {model_type}")
    if model_type=='bert-base-uncased' or model_type=='bert-large-uncased':
        return QueryTokenizer(maxlen,model_type, attend_to_mask_tokens)
    elif model_type=='tinybert':
        return QueryTokenizer(maxlen, 'bert-base-uncased',attend_to_mask_tokens)
    elif model_type=='xlm-roberta-base' or model_type=='xlm-roberta-large':
        return QueryTokenizerXLMR(maxlen, model_type)
    elif model_type=='roberta-base' or model_type=='roberta-large':
        return QueryTokenizerRoberta(maxlen, model_type)
    else:
        raise NotImplementedError