AI4Bharat / IndicLID

Language Identification for Indian languages
11 stars 4 forks source link

AttributeError: 'BertModel' object has no attribute 'attn_implementation' #6

Open razzzeeev opened 3 months ago

razzzeeev commented 3 months ago
batch_size = 1
y= df["Hindi"].tolist()
outputs = IndicLID_model.batch_predict(y, batch_size)
print(outputs)

I am using a dataframe to predict the langauge. But encountering above issue.

s-smits commented 1 month ago

Same issue here. datasets==2.14.6 pandas==2.2.2 peft==0.10.0 scikit_learn==1.3.2 torch==2.2.0 git+https://github.com/huggingface/transformers.git@main sentence-transformers trl

ammarbagasrawala commented 1 week ago

The same issue is happening here. I tried debugging it, and it seems that periods (full stops) at certain points either resolves the issue or causes the error to appear. In some instances, removing full stops resolves the error. Example:

IndicLID_model.batch_predict(["maahe noor. Kahaniyan"], batch_size=1) AttributeError: 'BertModel' object has no attribute 'attn_implementation' IndicLID_model.batch_predict(["maahe noor Kahaniyan"], batch_size=1) # full stop removed [('maahe noor Kahaniyan', 'mai_Latn', 0.81997746, 'IndicLID-FTR')]

While in other cases where the full stop initially worked fine, removing it causes the error to reappear. Example:

IndicLID_model.batch_predict(["Band ne is gaane ka ek animated nuskha jaari kiya hai jis kee hidayat Zeeshan Parvez ne dee hain."], batch_size=1)

[('Band ne is gaane ka ek animated nuskha jaari kiya hai jis kee hidayat Zeeshan Parvez ne dee hain.', 'eng_Latn', 0.937715, 'IndicLID-FTR')]

IndicLID_model.batch_predict(["Band ne is gaane ka ek animated nuskha jaari kiya hai jis kee hidayat Zeeshan Parvez ne dee hain"], batch_size=1) # full stop removed

AttributeError: 'BertModel' object has no attribute 'attn_implementation'

razzzeeev commented 1 week ago

@ammarbagasrawala , @s-smits Hi, There is some problem with the new Transformer Version itself, try downgrading it, it worked for me. FYI https://github.com/huggingface/transformers/issues/30965#issuecomment-2246229856

ammarbagasrawala commented 1 week ago

@razzzeeev thanks a lot!! it worked