TypeError: 'bool' object is not callable
See original GitHub issueI’m training BART summarization model - following as per the documentation example. But I’m getting above mentioned error. Am I doing something wrong?
model_args = {
"reprocess_input_data": True,
"overwrite_output_dir": True,
"max_seq_length": 128,
"train_batch_size": 2,
"num_train_epochs": 10,
"save_eval_checkpoints": False,
"save_model_every_epoch": False,
"evaluate_during_training": True,
"evaluate_generated_text": True,
"evaluate_during_training_verbose": True,
"use_multiprocessing": False,
"max_length": 50,
"manual_seed": 4,
}
from simpletransformers.seq2seq import Seq2SeqModel
model = Seq2SeqModel(
encoder_decoder_type="bart",
encoder_decoder_name="facebook/bart-large",
args=model_args,
)
model.train_model(train_df[:100], eval_data=eval_df[:100], use_cuda=True)
Error Trace
TypeError
Traceback (most recent call last)
<ipython-input-16-724cb9663289> in <module>
9
10 # Train the model
---> 11 model.train_model(train_df[:100], eval_data=eval_df[:100], use_cuda=True)
/opt/conda/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_model.py in train_model(self, train_data, output_dir, show_running_loss, args, eval_data, verbose, **kwargs)
284 eval_data=eval_data,
285 verbose=verbose,
--> 286 **kwargs,
287 )
288
/opt/conda/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_model.py in train(self, train_dataset, output_dir, show_running_loss, eval_data, verbose, **kwargs)
623 verbose=verbose and args.evaluate_during_training_verbose,
624 silent=args.evaluate_during_training_silent,
--> 625 **kwargs,
626 )
627
/opt/conda/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_model.py in eval_model(self, eval_data, output_dir, verbose, silent, **kwargs)
719 preds = self.predict(to_predict)
720
--> 721 result = self.compute_metrics(eval_data["target_text"].tolist(), preds, **kwargs)
722 self.results.update(result)
723
/opt/conda/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_model.py in compute_metrics(self, labels, preds, **kwargs)
876 results = {}
877 for metric, func in kwargs.items():
--> 878 results[metric] = func(labels, preds)
879
880 return results
TypeError: 'bool' object is not callable
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeError: 'bool' object is not callable - python - Stack Overflow
The solution is use a different name for the variable than you do for the method. Share. Share a link to this answer....
Read more >HELP! TypeError: 'bool' object is not callable : r/learnpython
You are assigning the returned boolean value to 'math' by calling 'math_battle' function (using the parentheses). You have to assign the ...
Read more >TypeError: 'bool' object is not callable - Replit
It's as it says, you cannot call a bool as the function you're calling, "check_rows()" is equal to the bool "True". I don't...
Read more >wb.Save() throws TypeError: 'bool' object is not callable #1279
Save() and gives an exception "TypeError: 'bool' object is not callable". I tried but I am not able to find the root cause...
Read more >What is the Python error `TypeError: 'bool' object is ... - Odoo
Error occurs because dictionary returned {'credit_account_id': False}, expected {'credit_account_id': [1,2,3...]} or smth like that. Hope this will help.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, you can train a T5 model with any custom prefix. If you are doing a task that it has already been trained on, it might be best to use the original prefix though. For example, T5 is already trained for summarization. You can look at the paper (or the blog) for more details.
use_cuda=True
should be passed when creating the model, not totrain_model
.E.g.