Attribute Error
MarcosFP97 opened this issue · comments
Hi, I am using MonoT5
model to rerank my own collection. However I am getting the following error:
Traceback (most recent call last):
File "pygaggle/passaget5.py", line 100, in <module>
reranked_total = reranker.rerank(query_total, texts)
File "/usr/src/app/pygaggle/pygaggle/rerank/transformer.py", line 60, in rerank
return_last_logits=True)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/usr/src/app/pygaggle/pygaggle/model/decode.py", line 27, in greedy_decode
use_cache=True)
TypeError: prepare_inputs_for_generation() missing 1 required positional argument: 'encoder_outputs'
Exception ignored in: <bound method Buckets.__del__ of <tensorflow.python.eager.monitoring.ExponentialBuckets object at 0x7f4864fa5108>>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/monitoring.py", line 407, in __del__
AttributeError: 'NoneType' object has no attribute TFE_MonitoringDeleteBuckets
My code is the following, and I have checked that query_total
and texts
variables are non-empty:
doc_passages = [p for p in doc_passages if p]
texts = [ Text(p, None, 0) for p in doc_passages]
query_total = Query(hand_expression_total)
print("Query total", query_total)
print("Texts", texts[0])
reranked_total = reranker.rerank(query_total, texts)
reranked_total.sort(key=lambda x: x.score, reverse=True)
Hi @MarcosFP97 which transformers version are you using?
pygaggle is currently using transformers==2.10.0
newer version of transformers may cause the error below.
TypeError: prepare_inputs_for_generation() missing 1 required positional argument: 'encoder_outputs'
we are working on update transformers dependency to 3.4.0 (#107) but before that could you double check if transformers==2.10.0?
Hi @MXueguang, that was the problem! I downgraded transformers
to 2.10.0 and the error disappeared. I will wait to the new release to upgrade transformers version again. Thank you very much!