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
need to add
!pip install gymnasium==0.29.1 pickle5
from stable_baselines3 import PPO
before loading the model from hugging face :
from huggingface_sb3 import load_from_hub
from stable_baselines3 import PPO
repo_id = "ToonAga/ppo-LunarLander-v2" # The repo_id
filename = "ppo-LunarLander-v2.zip" # The model filename.zip
When the model was trained on Python 3.8 the pickle protocol is 5
But Python 3.6, 3.7 use protocol 4
In order to get compatibility we need to:
1. Install pickle5 (we done it at the beginning of the colab)
2. Create a custom empty object we pass as parameter to PPO.load()
need to add
!pip install gymnasium==0.29.1 pickle5
from stable_baselines3 import PPO
before loading the model from hugging face :
from huggingface_sb3 import load_from_hub
from stable_baselines3 import PPO
repo_id = "ToonAga/ppo-LunarLander-v2" # The repo_id
filename = "ppo-LunarLander-v2.zip" # The model filename.zip
When the model was trained on Python 3.8 the pickle protocol is 5
But Python 3.6, 3.7 use protocol 4
In order to get compatibility we need to:
1. Install pickle5 (we done it at the beginning of the colab)
2. Create a custom empty object we pass as parameter to PPO.load()
custom_objects = {
"learning_rate": 0.0,
"lr_schedule": lambda _: 0.0,
"clip_range": lambda _: 0.0,
}
checkpoint = load_from_hub(repo_id, filename)
model = PPO.load(checkpoint, custom_objects=custom_objects, print_system_info=True)
The text was updated successfully, but these errors were encountered: