Sample code is not running on colab

#12
by helloansuman - opened

AttributeError Traceback (most recent call last)
/tmp/ipython-input-510877462.py in <cell line: 0>()
44 # Generate translations using the model
45 with torch.no_grad():
---> 46 generated_tokens = model.generate(
47 **inputs,
48 use_cache=True,

11 frames
~/.cache/huggingface/modules/transformers_modules/ai4bharat/indictrans2_hyphen_indic_hyphen_en_hyphen_1B/ac3daf0ecd37be3b6957764a9179ab2b07fa9d6a/modeling_indictrans.py in forward(self, input_ids, attention_mask, encoder_hidden_states, encoder_attention_mask, head_mask, cross_attn_head_mask, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)
1359 # past_key_values_length
1360 past_key_values_length = (
-> 1361 past_key_values[0][0].shape[2] if past_key_values is not None else 0
1362 )
1363

AttributeError: 'NoneType' object has no attribute 'shape'

Sign up or log in to comment