ohmeow / blurr

A library that integrates huggingface transformers with the world of fastai, giving fastai devs everything they need to train, evaluate, and deploy transformer specific models.
https://ohmeow.github.io/blurr
Apache License 2.0
289 stars 34 forks source link

Issues with blurr_summarize returning the error 'BartConfig' object has no attribute 'exponential_decay_length_penalty' #90

Open ReethiJ opened 1 year ago

ReethiJ commented 1 year ago

learn.blurr_summarize(test_article)

On running the above blurr_summarize() function it returns the error:

AttributeError: 'BartConfig' object has no attribute 'exponential_decay_length_penalty'

The stack trace:


~/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/blurr/text/modeling/core.py in blurr_generate(self, items, key, **kwargs)
    249         input_ids = input_ids.to(self.model.hf_model.device)
    250 
--> 251         gen_texts = self.model.hf_model.generate(input_ids, **text_gen_kwargs)
    252         outputs = [hf_tokenizer.decode(txt, skip_special_tokens=True, clean_up_tokenization_spaces=False) for txt in gen_texts]
    253 

~/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
     25         def decorate_context(*args, **kwargs):
     26             with self.clone():
---> 27                 return func(*args, **kwargs)
     28         return cast(F, decorate_context)
     29 

~/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/transformers/generation/utils.py in generate(self, inputs, generation_config, logits_processor, stopping_criteria, prefix_allowed_tokens_fn, synced_gpus, **kwargs)
   1181             # legacy: users may modify the model configuration to control generation -- update the generation config
   1182             # model attribute accordingly, if it was created from the model config
-> 1183             if self.generation_config._from_model_config:
   1184                 new_generation_config = GenerationConfig.from_model_config(self.config)
   1185                 if new_generation_config != self.generation_config:

~/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
   1267             if name in modules:
   1268                 return modules[name]
-> 1269         raise AttributeError("'{}' object has no attribute '{}'".format(
   1270             type(self).__name__, name))
   1271 

AttributeError: 'BartForConditionalGeneration' object has no attribute 'generation_config'

Other APIs such as blurr_generate(), blurr_predict() also seem to be returning similar errors