Custon Env works in local PC but not in Google Colab

Hi @Lars_Simon_Zehnder sorry the delay.

I tried with your suggestion but still did not work.

I solve the problem saving my environment configuration in a GitHub repository and the cloning the repository in Google Colab to acces to the environment files:

# clone the public repository
!git clone https://github.com/user/my_repository

# add the repository to the path
import sys
sys.path.append('/content/my_repository')

Finally, I use the following code to check the serialization:

from ray.util import inspect_serializability
from my_repository.env_folder import custom_env

is_serializable, unserializable_objects = inspect_serializability(custom_env, depth=10)
print(f"Is serializable: {is_serializable}")
if not is_serializable:
    print("Unserializable objects:")
    for obj in unserializable_objects:
        print(obj)

and the exit was:

================================================================================
Checking Serializability of <class 'my_repository.env_folder.custom_env'>
================================================================================
Is serializable: True
1 Like