jinfenglin / TraceBERT

21 stars 9 forks source link

AttributeError: 'DataParallel' object has no attribute 'device' #10

Open pigeonwx opened 1 year ago

pigeonwx commented 1 year ago

when I tried the first step to train on the JAVA dataset of 'codesearchnet', it happened that : random_neg_sampling_dataset: 100%|██████████████████████████████████████████████▉| 202401/202413 [27:25<00:00, 128.03it/s] random_neg_sampling_dataset: 100%|███████████████████████████████████████████████| 202413/202413 [27:25<00:00, 123.02it/s]

Epoch: 0%| | 0/8 [27:26<?, ?it/s] processing ../data/code_search_net/java/final/jsonl/valid/java_valid_0.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_15.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_11.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_9.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_7.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_12.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_5.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_3.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_4.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_14.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_6.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_0.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_10.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_13.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_1.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_2.jsonl.gz processing ../data/code_search_net/java/final/jsonl/train/java_train_8.jsonl.gz Traceback (most recent call last): File "siamese2_train.py", line 20, in main() File "siamese2_train.py", line 15, in main train(args, train_examples, valid_examples, model, train_iter_method=train_with_neg_sampling) File "../../code_search/twin/twin_train.py", line 279, in train train_iter_method(*params) File "../../code_search/twin/twin_train.py", line 89, in train_with_neg_sampling labels = batch[2].to(model.device) File "~/anaconda3/envs/codelink/lib/python3.7/site-packages/torch/nn/modules/module.py", line 594, in getattr type(self).name, name)) AttributeError: 'DataParallel' object has no attribute 'device'

Steps: 0%|

I want to know what caused this. Thanks!