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
I am using BERT model. The problem arises in trainer module
#15300 File "~/lib/python3.6/site-packages/transformers/trainer.py", line 1608, in save_model
ShardedDDPOption.ZERO_DP_2 in self.args.sharded_ddp or ShardedDDPOption.ZERO_DP_3 in self.args.sharded_ddp
TypeError: 'in ' requires string as left operand, not ShardedDDPOption
I am training a Bert Model for a multi-class classification task
To reproduce
Steps to reproduce the behavior:
Code
importlogging
import os
from statistics import mean, stdev
import sys
from typing import Callable, Dict
import pandas as pd
import numpy as np
from pprint import pformat
from scipy.special import softmax
import tensorboard
import torch
from multimodal_args import ModelArguments, MultiModalDataArguments, MultiModalTrainingArguments
from evaluation import calc_classification_metrics, calc_regression_metrics
from load_dataset import load_datadir
from config import TabularConfig
from auto_fusion_model import AutoModelFusion
from utils import create_dir_if_not_exists
for metric_name in metric_keys:
if type(total_test_results[0][metric_name]) is str:
continue
res_list = []
for results in total_test_results:
res_list.append(results[metric_name])
if len(res_list) == 1:
metric_avg = res_list[0]
metric_stdev = 0
else:
metric_avg = mean(res_list)
metric_stdev = stdev(res_list)
aggr_results[metric_name + '_mean'] = metric_avg
aggr_results[metric_name + '_stdev'] = metric_stdev
return aggr_results
if name == 'main':
main()
2. Error
Traceback (most recent call last):
File "run.py", line 289, in <module>
main()
File "run.py", line 191, in main
trainer.save_model() # Saves the tokenizer too for easy upload
File "/home/avimodi/anaconda3/envs/chakanik_transformer/lib/python3.6/site-packages/transformers/trainer.py", line 1608, in save_model
**ShardedDDPOption.ZERO_DP_2 in self.args.sharded_ddp or ShardedDDPOption.ZERO_DP_3 in self.args.sharded_ddp
TypeError: 'in <string>' requires string as left operand, not ShardedDDPOption**
Killing subprocess 122966
Traceback (most recent call last):
File "/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File /lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/avimodi/anaconda3/envs/chakanik_transformer/lib/python3.6/site-packages/torch/distributed/launch.py", line 340, in <module>
main()
File "/home/avimodi/anaconda3/envs/chakanik_transformer/lib/python3.6/site-packages/torch/distributed/launch.py", line 326, in main
sigkill_handler(signal.SIGTERM, None) # not coming back
File "/lib/python3.6/site-packages/torch/distributed/launch.py", line 301, in sigkill_handler
raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd)
3.
<!-- If you have code snippets, error messages, stack traces please provide them here as well.
Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->
## Expected behavior
<!-- A clear and concise description of what you would expect to happen. -->
The text was updated successfully, but these errors were encountered:
The error comes from the value you have in args.sharded_ddp where args is your MultiModalTrainingArguments object. Since you did not share the code of that class, there is little we can do to help fix the issue.
Also, please use the forums to debug your code as we keep the issues for bugs and feature requests only :-)
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Environment info
transformers
version: 4.5.1Models:
BERT
I am using BERT model. The problem arises in trainer module
#15300 File "~/lib/python3.6/site-packages/transformers/trainer.py", line 1608, in save_model
ShardedDDPOption.ZERO_DP_2 in self.args.sharded_ddp or ShardedDDPOption.ZERO_DP_3 in self.args.sharded_ddp
TypeError: 'in ' requires string as left operand, not ShardedDDPOption
I am training a Bert Model for a multi-class classification task
To reproduce
Steps to reproduce the behavior:
import os
from statistics import mean, stdev
import sys
from typing import Callable, Dict
import pandas as pd
import numpy as np
from pprint import pformat
from scipy.special import softmax
import tensorboard
import torch
from transformers import (
AutoTokenizer,
AutoConfig,
HfArgumentParser,
Trainer,
EvalPrediction,
set_seed
)
from multimodal_args import ModelArguments, MultiModalDataArguments, MultiModalTrainingArguments
from evaluation import calc_classification_metrics, calc_regression_metrics
from load_dataset import load_datadir
from config import TabularConfig
from auto_fusion_model import AutoModelFusion
from utils import create_dir_if_not_exists
os.environ['COMET_MODE'] = 'DISABLED'
logger = logging.getLogger(name)
def main():
def aggregate_results(total_test_results):
metric_keys = list(total_test_results[0].keys())
aggr_results = dict()
if name == 'main':
main()
The text was updated successfully, but these errors were encountered: