def convert_by_vocab_dict(vocab_dict, items):
    """
    Converts a sequence of [tokens|ids] according to the vocab dict.
    """
    output = []
    for item in items:
        if item in vocab_dict:
            output.append(vocab_dict[item])
        else:
            output.append(vocab_dict["<unk>"])
    return output