You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
After training on local machine, running the eval code:
result= model.eval_model(test_file)
My config:
model_args = LanguageModelingArgs()
model_args.reprocess_input_data = True
model_args.overwrite_output_dir = True
model_args.num_train_epochs = 1
model_args.best_model_dir = "outputs"
model_args.save_best_model =True
model_args.train_batch_size = 64
model_args.dataset_type = "simple"
model_args.mlm = False # mlm must be False for CLM
model_args.vocab_size = 50257
Error message:
-----------------
_UnboundLocalError Traceback (most recent call last)
Cell In[33], line 2
1 # Evaluate the model
----> 2 result= model.eval_model(test_file)
File ~\anaconda3\envs\training_pytorch\Lib\site-packages\simpletransformers\language_modeling\language_modeling_model.py:1367, in LanguageModelingModel.eval_model(self, eval_file, output_dir, evaluate_generated_text, verbose, silent, **kwargs)
1362 eval_dataset = self.load_and_cache_examples(
1363 eval_file, evaluate=True, verbose=verbose, silent=silent
1364 )
1365 os.makedirs(output_dir, exist_ok=True)
-> 1367 result = self.evaluate(
1368 eval_dataset, output_dir, verbose=verbose, silent=silent, **kwargs
1369 )
1370 self.results.update(result)
1372 if verbose:
File ~\anaconda3\envs\training_pytorch\Lib\site-packages\simpletransformers\language_modeling\language_modeling_model.py:1436, in LanguageModelingModel.evaluate(self, eval_dataset, output_dir, prefix, verbose, silent, **kwargs)
1430 if self.args.use_hf_datasets:
1431 input_ids = batch["input_ids"]
1433 inputs, labels = (
1434 mask_tokens(batch, tokenizer, args)
1435 if args.mlm
-> 1436 else (input_ids, input_ids)
1437 )
1438 inputs = inputs.to(self.device)
1439 labels = labels.to(self.device)
UnboundLocalError: cannot access local variable 'input_ids' where it is not associated with a value_
Beta Was this translation helpful? Give feedback.
All reactions