MASKER icon indicating copy to clipboard operation
MASKER copied to clipboard

Code issue

Open pzw1231 opened this issue 3 years ago • 1 comments

I run the following code:

python train.py --dataset foods --split_ratio 0.25 --seed 0
--train_type base
--backbone bert --classifier_type softmax --optimizer adam_vanilla \

Encountered the following problem:

Loading pre-trained backbone network... Initializing dataset and model... Initializing base dataset... (name: foods) Training model... Traceback (most recent call last): File "train.py", line 109, in main() File "train.py", line 75, in main train_base(args, train_loader, model, optimizer, epoch) File "/home/bigdata11/pzw/MASKER/training/base.py", line 27, in train_base out_cls = model(tokens) # (B, C) File "/home/bigdata11/anaconda3/envs/pzw/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/bigdata11/pzw/MASKER/models.py", line 48, in forward out_p = self.dropout(out_p) File "/home/bigdata11/anaconda3/envs/pzw/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/bigdata11/anaconda3/envs/pzw/lib/python3.6/site-packages/torch/nn/modules/dropout.py", line 58, in forward return F.dropout(input, self.p, self.training, self.inplace) File "/home/bigdata11/anaconda3/envs/pzw/lib/python3.6/site-packages/torch/nn/functional.py", line 983, in dropout else _VF.dropout(input, p, training)) TypeError: dropout(): argument 'input' (position 1) must be Tensor, not str

pzw1231 avatar Mar 06 '21 12:03 pzw1231

I have the same problem. It's beacuse of wrong version of transfomers.#1392 But after changing transformers' version, the torch will report a error: ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' when running preprocess.py( torch-1.9.0)

Please show the requirements.

MrSworder avatar Jun 30 '22 13:06 MrSworder