Deprecation warning: "Passing a tuple of `past_key_values` is deprecated"
Bug report checklist
- [x] I provided code that demonstrates a minimal reproducible example.
- [x] I confirmed bug exists on the latest mainline of Chronos via source install.
Describe the bug
When running the example code from readme using amazon/chronos-bolt-base I get:
Passing a tuple of `past_key_values` is deprecated and will be removed in Transformers v4.48.0. You should pass an instance of `EncoderDecoderCache` instead, e.g. `past_key_values=EncoderDecoderCache.from_legacy_cache(past_key_values)`.
Expected behavior No deprecation warning
To reproduce
pipeline: BaseChronosPipeline = BaseChronosPipeline.from_pretrained(
"amazon/chronos-bolt-base", # use "amazon/chronos-bolt-small" for the corresponding Chronos-Bolt model
device_map="cpu", # use "cpu" for CPU inference
torch_dtype=torch.bfloat16,
)
quantiles, mean = pipeline.predict_quantiles(
context=torch.tensor(df["#Passengers"][:-12]),
prediction_length=12,
quantile_levels=[0.1, 0.5, 0.9],
)
Environment description Operating system: macOS Python version: 3.12 CUDA version: NA PyTorch version: HuggingFace transformers version: HuggingFace accelerate version:
Hi @corneliusroemer, thanks for opening the issue. The warning is generated here https://github.com/huggingface/transformers/blob/69bc848480d5f19a537a70ce14f09816b00cd80f/src/transformers/models/t5/modeling_t5.py#L1024 which appears not to be checking for the None case (last elif clause never applies). I’m wondering if this is the real issue
A similar fix was applied here to other models https://github.com/huggingface/transformers/pull/33541 maybe all is needed is a similar one for T5
I'll try to fix within in a week if no one else wants to.
@trzysiek are you actually facing problems/errors due to this? If yes, can you share an example?
Hi @abdulfatir , I see this was closed, but I can confirm I'm still seeing this deprecation warning. It makes using the model in production very uncomfortable because it creates a warning every time the model runs, which is very noisy for our logs.