[Python] 'NoneType' object has no attribute 'encode' when loading tokenizer

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    Error occurs when trying to load Pegasus model for text summarization

    from transformers import pipeline, set_seed
    pipe = pipeline("summarization", model="google/pegasus-cnn_dailymail")


    Error: AttributeError: 'NoneType' object has no attribute 'encode'

    1588 logger.info("Converting from Tiktoken")
    1589 return TikTokenConverter(
    1590 vocab_file=transformer_tokenizer.vocab_file,
    1591 additional_special_tokens=transformer_tokenizer.additional_special_tokens,
    -> 1592 ).converted()
    1593 except Exception:


    I've installed tiktoken and restarted the kernel, but the same error occurs

    Continue reading...

Compartilhe esta Página