Skip to content

Index error for small token amounts #84

@oz03-hub

Description

@oz03-hub

Hello again, I noticed a strange behavior while developing using llmlingua, for small prompts such as "hello" or "who", compress function throws an error for index 0 out of range.

` """
Token compression using llmlingua that uses gpt-2 small llm.
"""

llm_lingua = PromptCompressor(model_name=optimizer_model, device_map=device_map)

try:
    print(user_prompt)
    print("Compressing")
    compressed_prompt = llm_lingua.compress_prompt(
        context=[user_prompt],
        ratio=0.2,
    )

`

here is initialization to trigger error, thanks and I am looking forward to updates

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions