Replies: 1 comment
-
I solved this by adding |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a complex data structure that requires adding every sample of my dataset to a dictionary
_annotation_ids_str_to_int
.This variable is common to the training, validation, and test splits. It is defined as a global variable in a module.
The variable seems to be initialized correctly. However, at training time, the variable needs to be accessed by the
__getitem__
function. This function finds the variable to be empty.I am not sure if the variable has been reinitialized or the issue is caused by multithreading or multiprocessing.
How do I get the
__getitem__
function to properly access_annotation_ids_str_to_int
?Here's a dummy code that you can use to reproduce the error. It is composed of two files. Note the print calls that will help you to find the issue.
Also, note that the variable
_annotation_ids_str_to_int
is not exactly a dictionary, but it is instead a bidictionary which is simply a dictionary that offers a mapping from value to key when accessingmy_dict.inverse
.main.py
my_datamodule.py
The output is the following:
I am using python 3.8.14 on macOS with the following requirements:
Beta Was this translation helpful? Give feedback.
All reactions