Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--allfolds KeyError #60

Closed
SanFran-Me opened this issue Oct 8, 2023 · 6 comments
Closed

--allfolds KeyError #60

SanFran-Me opened this issue Oct 8, 2023 · 6 comments

Comments

@SanFran-Me
Copy link

SanFran-Me commented Oct 8, 2023

when I use --allfolds flag

KeyError: 'train'
@Dadiao-shuai
Copy link

I also encountered this error when I use --allfolds to train on a single types file 'train_all.types' with
python3 train.py -m default2018.model --allfolds -p train_all -d /root/gnina_docker --weights crossdock_default2018.caffemodel --dynamic

  File "train.py", line 479, in train_and_test_model
    idx = test_idxs[key]
KeyError: 'train'

@dkoes
Copy link
Contributor

dkoes commented Oct 10, 2023

You can skip the case where the key isn't in test_idxs. This is happening because the train and test set are the same so the train set isn't put in test_idxs.

if key not in test_idxs: continue

dkoes added a commit that referenced this issue Oct 10, 2023
@JonasLi-19
Copy link

Hello professor, it might still need some other codes modified when running --allfolds option:

Iteration 1000
Train time: 208.816554
Traceback (most recent call last):
  File "train.py", line 934, in <module>
    results = train_and_test_model(args, train_test_files[i], outname, cont)
  File "train.py", line 541, in train_and_test_model
    test_net, n_tests = test_nets[key]
KeyError: 'train'

@JonasLi-19
Copy link

JonasLi-19 commented Oct 18, 2023

--allfolds still causes error:


Iteration 1000
Train time: 208.816554
Traceback (most recent call last):
  File "train.py", line 934, in <module>
    results = train_and_test_model(args, train_test_files[i], outname, cont)
  File "train.py", line 541, in train_and_test_model
    test_net, n_tests = test_nets[key]
KeyError: 'train'

so can I directly add : if key not in test_idxs: continue

        #evaluate train set
        start = time.time()
        if use_reduced and (not last_test or args.skip_full):
            key = 'reduced_train'
        else:
            key = 'train'
        test_net, n_tests = test_nets[key]
        freemem()

@SanFran-Me SanFran-Me changed the title Why --allfolds lead to KeyError --allfolds KeyError Oct 18, 2023
@JonasLi-19
Copy link

I tried directly add : if key not in test_idxs: continue

        #evaluate train set
        start = time.time()
        if use_reduced and (not last_test or args.skip_full):
            key = 'reduced_train'
        else:
            key = 'train'
        test_net, n_tests = test_nets[key]
        freemem()

it avoid the error.

But I find the result .out file cannot be generated! #62

@Dadiao-shuai
Copy link

even I follow the modifications, I find --allfolds cannot generate .out files, too! @JonasLi-19

You can skip the case where the key isn't in test_idxs. This is happening because the train and test set are the same so the train set isn't put in test_idxs.

if key not in test_idxs: continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants