File size: 431 Bytes
753bb61
 
 
 
 
 
 
993992c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Use a pipeline as a high-level helper
from transformers import pipeline

messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe = pipeline("text-generation", model="microsoft/Phi-3.5-mini-instruct", trust_remote_code=True)

output = pipe(
    messages,
    past_length=0,           # Example: starting with an empty cache
    max_cache_length=1024,   # Example: allow up to 1024 tokens in the cache
)

print(output)