T5 model error: accessing variable that has not been defined

Hi!

I will investigate this in more details over the weekend, but meanwhile would like to share an error that I have just encountered:

UnboundLocalError: local variable 'is_updated' referenced before assignment

I am seeing this error in transformers library version 4.55.3. In particular, it is this line. The variables is_cross_attention is true and past_key_value is not none, while is_updated is not set (line 495 does not run). Previously, I was using library version 4.51.3 and was not observing this behavior (same line). This is probably due to updates in lines 497 (version 4.51.3) and 494 (version 4.55.3):

if past_key_value is not None and isinstance(past_key_value, EncoderDecoderCache):    # 5.55.3
if past_key_value is not None:                                                        # 4.51.3

I think the type of the past_key_value is not EncoderDecoderCache. I am using the transformers library:

  • With amazon-science/chronos-forecasting project at commit f40a266a550e37ac16cb6c46dd29a6183f39f618 (sorry, can’t attach the URL due to limit - I am a new user here).
  • I can see this error when model is autogluon/chronos-bolt-tiny (have not tested other models yet).

I downgraded the transformers library back to 4.51.3 and now it works OK.

1 Like

I think it would be best to report this observation directly as an issue in the Transformers repository

1 Like