boschresearch / EaT-PIM

EaT-PIM (Embedding and Transforming Procedural Instructions for Modification)
GNU Affero General Public License v3.0
4 stars 5 forks source link

a frozendict error when Running eatpim/embeddings/codes/run.py #1

Closed shinymoon99 closed 1 year ago

shinymoon99 commented 1 year ago

description

I met problem while reproducing the result. At step 5 I encountered an error.

environment

PyTorch 1.11.0 Python 3.8(ubuntu20.04) Cuda 11.3

issue reproduce

  1. /EaT-PIM-main# python eatpim/etl/parse_documents.py --output_dir rec_parse_test --n_recipes 1000
  2. /EaT-PIM-main# python eatpim/etl/preprocess_unique_names_and_linking.py --input_dir rec_parse_test
  3. /EaT-PIM-main# python eatpim/etl/transform_parse_results.py --input_dir rec_parse_test --n_cpu 6
  4. /EaT-PIM-main# python eatpim/etl/eatpim_reformat_flowgraph_parse_results.py --input_dir rec_parse_test
  5. (venv) root@autodl-container-6677118aac-93761f38:~/EaT-PIM-main# python eatpim/embeddings/codes/run.py --do_train --cuda --data_path recipe_parse_test --model TransE -n 256 -b 2048 --train_triples_every_n 100 -d 200 -g 24.0 -a 1.0 -lr 0.001 --max_steps 2000000 -save models/sm_transe_retry --test_batch_size 4 -adv -cpu 1 --warm_up_steps 150000 --save_checkpoint_steps 50000 --log_steps 5000

error info

(venv) root@autodl-container-6677118aac-93761f38:~/EaT-PIM-main# python eatpim/embeddings/codes/run.py --do_train --cuda --data_path rec_parse_test --model TransE -n 256 -b 2048 --train_triples_every_n 100 -d 200 -g 24.0 -a 1.0 -lr 0.001 --max_steps 2000000 -save models/sm_transe_retry --test_batch_size 4 -adv -cpu 1 --warm_up_steps 150000 --save_checkpoint_steps 50000 --log_steps 5000

2023-01-10 16:04:18,070 INFO Model: TransE

2023-01-10 16:04:18,070 INFO Data Path: rec_parse_test

2023-01-10 16:04:18,070 INFO #entity: 15884

2023-01-10 16:04:18,070 INFO #relation: 602

2023-01-10 16:04:18,110 INFO #train: 560

2023-01-10 16:04:18,119 INFO #valid: 120

2023-01-10 16:04:18,136 INFO #test: 120

2023-01-10 16:04:18,240 INFO #train triples: 25946

2023-01-10 16:04:18,249 INFO #valid triples: 5560

2023-01-10 16:04:18,258 INFO #test triples: 5561

2023-01-10 16:04:20,492 INFO Model Parameter Configuration:

2023-01-10 16:04:20,493 INFO Parameter gamma: torch.Size([1]), require_grad = False

2023-01-10 16:04:20,493 INFO Parameter embedding_range: torch.Size([1]), require_grad = False

2023-01-10 16:04:20,493 INFO Parameter entity_embedding: torch.Size([15884, 200]), require_grad = True

2023-01-10 16:04:20,493 INFO Parameter relation_embedding: torch.Size([602, 200]), require_grad = True

2023-01-10 16:04:20,493 INFO Parameter agg_w.0.weight: torch.Size([200, 200]), require_grad = True

2023-01-10 16:04:20,493 INFO Parameter agg_w.0.bias: torch.Size([200]), require_grad = True

2023-01-10 16:04:20,493 INFO Parameter agg_w.2.weight: torch.Size([200, 200]), require_grad = True

2023-01-10 16:04:20,493 INFO Parameter agg_w.2.bias: torch.Size([200]), require_grad = True

2023-01-10 16:04:20,890 INFO Ramdomly Initializing TransE Model...

2023-01-10 16:04:20,890 INFO Start Training...

2023-01-10 16:04:20,890 INFO init_step = 0

2023-01-10 16:04:20,890 INFO batch_size = 2048

2023-01-10 16:04:20,890 INFO negative_adversarial_sampling = 1

2023-01-10 16:04:20,890 INFO hidden_dim = 200

2023-01-10 16:04:20,890 INFO gamma = 24.000000

2023-01-10 16:04:20,890 INFO negative_adversarial_sampling = True

2023-01-10 16:04:20,890 INFO adversarial_temperature = 1.000000

2023-01-10 16:04:20,891 INFO learning_rate = 0.001000

Traceback (most recent call last):

File "eatpim/embeddings/codes/run.py", line 492, in

main\(parse\_args\(\)\)

File "eatpim/embeddings/codes/run.py", line 430, in main

log = kge\_model\.train\_step\(kge\_model, optimizer, graph\_train\_iterator, args\)

File "/root/EaT-PIM-main/eatpim/embeddings/codes/model.py", line 632, in train_step

positive\_sample, negative\_sample, subsampling\_weight, mode = next\(train\_iterator\)

File "/root/EaT-PIM-main/eatpim/embeddings/codes/dataloader.py", line 688, in __next__

data = next\(self\.iterator\_tail\)

File "/root/EaT-PIM-main/eatpim/embeddings/codes/dataloader.py", line 697, in one_shot_iterator

for data in dataloader:

File "/root/EaT-PIM-main/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 628, in __next__

data = self\.\_next\_data\(\)

File "/root/EaT-PIM-main/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 671, in _next_data

data = self\.\_dataset\_fetcher\.fetch\(index\)  \# may raise StopIteration

File "/root/EaT-PIM-main/venv/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch

data = \[self\.dataset\[idx\] for idx in possibly\_batched\_index\]

File "/root/EaT-PIM-main/venv/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 58, in

data = \[self\.dataset\[idx\] for idx in possibly\_batched\_index\]

File "/root/EaT-PIM-main/eatpim/embeddings/codes/dataloader.py", line 302, in __getitem__

positive\_sample\_ops = self\.convert\_to\_tensors\(op\_leaf\_count, rand\_options, graph\_ops\)

File "/root/EaT-PIM-main/eatpim/embeddings/codes/dataloader.py", line 244, in convert_to_tensors

v\_list\[0\] = v

TypeError: int() argument must be a string, a bytes-like object or a number, not 'frozendict.frozendict'

(venv) root@autodl-container-6677118aac-93761f38:~/EaT-PIM-main#

yy20716 commented 1 year ago

@shinymoon99 Thanks for letting us know. We made a quick patch and it is merged into our main branch. Please try again if our patched version works for you. Thanks.