When I run the following code that from crnn, I get this error
def encode(self, text):
“”"Support batch or single str.
    Args:
        text (str or list of str): texts to convert.

    Returns:
        torch.IntTensor [length_0 + length_1 + ... length_{n - 1}]: encoded texts.
        torch.IntTensor [n]: length of each text.
    """
    length = []
    result = []
    for item in text:            
        if self.is_chinese(item): 		   
           # item = unicode(item,'utf-8')
           item = item.encode("utf-8")
        length.append(len(item))
        for char in item:				
            index = self.dict.get(char)                
            result.append(index)
        text = result
    return (torch.IntTensor(text), torch.IntTensor(length))