Amazon Bedrock's Claude warns "Token indices sequence length is longer than the specified maximum sequence length for this model (6526 > 1024)

0

I am doing a Workshop for Bedrock.

https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/02_Summarization/02.long-text-summarization-titan.ipynb

I am conducting this notebook on Claude v2, not Titan. However,

llm.get_num_tokens(letter)

When I run this, I get the message Token indices sequence length is longer than the specified maximum sequence length for this model (6526 > 1024). .

Claude should be able to handle a maximum of 100k tokens, so why am I getting this warning?

Is Token indices sequence length a different concept than max token 100k?

1 Antwort
0

Hi, I just tested it, and it worked well in my enviroment.

First, I assume you have update the repo to the latest version, of which the commit hash should be cfecb6215c8171ba2580949a426193ccaf4c5b7f by the time I write this answer.

Then, edit this section below in the file 02_Summarization/02.long-text-summarization-titan.ipynb,

from langchain.llms.bedrock import Bedrock

# llm = Bedrock(
#     model_id="amazon.titan-tg1-large",
#     model_kwargs={
#         "maxTokenCount": 4096,
#         "stopSequences": [],
#         "temperature": 0,
#         "topP": 1,
#     },
#     client=boto3_bedrock,
# )
llm = Bedrock(
    # model_id="anthropic.claude-v1",
    model_id="anthropic.claude-v2",
    model_kwargs={
        "max_tokens_to_sample":4096,
                 "temperature":0.5,
                 "top_k":250,
                 "top_p":0.5,
                 "stop_sequences":[]
    },
    client=boto3_bedrock,
)
shareholder_letter = "./letters/2022-letter.txt"

with open(shareholder_letter, "r") as file:
    letter = file.read()
    
llm.get_num_tokens(letter)

Then run 02_Summarization/02.long-text-summarization-titan.ipynb from the beginning, you should get the output: 6526 Enter image description here

AWS
beantwortet vor 8 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen