You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
I am running into an issue with the BucketingModule when using a sym_gen function that uses a parameter variable only for certain bucket keys. Consider the following example code:
['data']
['data']
module initialized with default bucket key
BUCKET KEY 1
['data', 'weight']
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: unordered_map::at: key not found
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
The crash happens in the mod.forward() call when trying to allocate/switch to a new bucket (1).
If the above sym_gen code is changed to use the weight variable for the default bucket key (e.g. change if bucket_key <= 1: to if bucket_key > 1:), everything runs fine, as the default graph probably has allocated memory for the weight variable.
My questions are as follows:
It took my a while to figure out the problem in my actual use case as the low-level error message is not really helpful. It'd be great if MXNet could guard against such parameter-related issues.
What is your general opinion about this kind of code? I can work around this issue by setting the default bucket key of the module to use 'all potential parameters' (in this case default_bucket_key=1), but in my use case that probably hurts memory sharing between buckets: usually one sets the default bucket key so that it corresopnds to the 'largest' computation graph (for example in terms of sequence length). In this particular example the questions is what is 'largest': largest sequence length, or largest w.r.t parameters/variables.
The text was updated successfully, but these errors were encountered:
Great thanks! It might very well be that this shouldn't be a supported use case (different # of parameters for different buckets in a module), but mxnet should at least have a more informative error message.
I am running into an issue with the BucketingModule when using a
sym_gen
function that uses a parameter variable only for certain bucket keys. Consider the following example code:The above code crashes with the following output:
The crash happens in the
mod.forward()
call when trying to allocate/switch to a new bucket (1).If the above sym_gen code is changed to use the
weight
variable for the default bucket key (e.g. changeif bucket_key <= 1:
toif bucket_key > 1:
), everything runs fine, as the default graph probably has allocated memory for theweight
variable.My questions are as follows:
The text was updated successfully, but these errors were encountered: