Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

RecursionError when attempting to unpickle objax objects #221

@bytbox

Description

@bytbox

This is with objax-1.4.0, from PyPI. The problem does not occur with objax-1.3.1.

For example:

(env) theseus:~/mlqm/de$ python
Python 3.9.2 (default, Feb 20 2021, 18:40:11)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle, objax
>>> try:
...     pickle.loads(pickle.dumps(objax.nn.Linear(3,1)))
... except RecursionError:
...     print('Recursion error')
...
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Recursion error

The error is coming from loads, not dumps. The resulting stack trace ends with:

  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 143, in __getattr__
    return getattr(self.value, name)
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 179, in value
    return self._value
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 143, in __getattr__
    return getattr(self.value, name)
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 179, in value
    return self._value
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 143, in __getattr__
    return getattr(self.value, name)
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 179, in value
    return self._value
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 143, in __getattr__
    return getattr(self.value, name)
  File "/home/scott/mlqm/env/lib/python3.9/site-packages/objax/variable.py", line 179, in value
    return self._value
RecursionError: maximum recursion depth exceeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions