reinforcementlearningcourse's People
Forkers
cl19951225 rounak97 git-shikha smartnamdevoloper reayd-nnip fordax domenicocutrupi mattpat1981 zboucek mehrdad-moradi kiriteegak kevincdurand1 francisco64 hercules261188 ali-9162603886 kristophergeorge zi-crypto joel-rc jewc yogeshwaranmurugaiyan textzip miouzikal koulkoudakis gauravzazz zlcode2021 elizabethrod2 fabiohelmer akshatananjappa oskarcode darkcoder2000 fbiller gxy2017 holmesvscl youngsoul llific abdelrahman489 kyledufrane gikman lartpl amayhew2 osievert maximbravo eran-lab sd99886 gerardonsch hanyuyao amirjamaldar cunrom muhamadelshazly tuhinharit absibs mbencherif malyang folafoyeg lakmalrupasinghe rishabhjindal45 himandy302 yowens2 amruth-ashok krishnatray tajrnabab niranjanhegde15 markas9 jude-spellacy yxzhou20 erenulu2020 woodymoo paulhan93 lukegriffiths samantoz harry6drain priyabansal68 hash-hh smahm094 amy373661491 prabhatyadavdatascientist cmichellbs nunovalverde kreptones puranjay14 whitewolf47 crackhegg ioanszilagyi prateek0562 shailesh2109 amarahai vdeeplearn anurag-ay tunjow bushieman mshans66 rosienguyen-volur bmendoz kk9087 egemenkarabyk hasanaldhahi vijita angelalee98 amirjarareh victinygithubreinforcementlearningcourse's Issues
Got AssertionError while loading trained autonomous driving models.
What I did in Jupyter Notebook:
import os
import gym
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3.common.evaluation import evaluate_policy
environment_name = "CarRacing-v0"
env = gym.make(environment_name)
env = DummyVecEnv([lambda: env])
ppo_path = os.path.join("Training", "Saved Models", "PPO_428k_Driving_model")
model = PPO.load(ppo_path, env)
When I run the last section, I got this AssertionError:
Wrapping the env in a VecTransposeImage.
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
d:\GitHub\autonomous-driving\ad_notebook.ipynb Cell 14 in <cell line: 2>()
[1](vscode-notebook-cell:/d%3A/GitHub/autonomous-driving/ad_notebook.ipynb#X16sZmlsZQ%3D%3D?line=0) # model.save(ppo_path)
----> [2](vscode-notebook-cell:/d%3A/GitHub/autonomous-driving/ad_notebook.ipynb#X16sZmlsZQ%3D%3D?line=1) model = PPO.load(ppo_path, env)
File c:\Users\user\anaconda3\envs\RLstation\lib\site-packages\stable_baselines3\common\base_class.py:747, in BaseAlgorithm.load(cls, path, env, device, custom_objects, print_system_info, force_reset, **kwargs)
745 model.__dict__.update(data)
746 model.__dict__.update(kwargs)
--> 747 model._setup_model()
749 # put state_dicts back in place
750 model.set_parameters(params, exact_match=True, device=device)
File c:\Users\user\anaconda3\envs\RLstation\lib\site-packages\stable_baselines3\ppo\ppo.py:168, in PPO._setup_model(self)
165 super()._setup_model()
167 # Initialize schedules for policy/value clipping
--> 168 self.clip_range = get_schedule_fn(self.clip_range)
169 if self.clip_range_vf is not None:
170 if isinstance(self.clip_range_vf, (float, int)):
File c:\Users\user\anaconda3\envs\RLstation\lib\site-packages\stable_baselines3\common\utils.py:91, in get_schedule_fn(value_schedule)
89 value_schedule = constant_fn(float(value_schedule))
90 else:
---> 91 assert callable(value_schedule)
92 return value_schedule
AssertionError:
So, I trained a model with PPO_2m_Driving_model.zip
and also got the same AssertionError. Do anyone know what is the problem?
Self Driving Car: .7z files won't work properly on the model
Unless I'm missing something on the tutorial, .7z files for the self-driving car won't work. I get the following Erro message:
Traceback (most recent call last):
File "/Users/vagman/Desktop/uni-classes/self-driving-car/car.py", line 38, in <module>
model = PPO.load(ppo_path, env)
File "/opt/homebrew/lib/python3.9/site-packages/stable_baselines3/common/base_class.py", line 709, in load
if "policy_kwargs" in data:
TypeError: argument of type 'NoneType' is not iterable
# 1. Import libraries
import os
import gym
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env.dummy_vec_env import DummyVecEnv
from stable_baselines3.common.evaluation import evaluate_policy
# 2. Test Environment
environment_name = "CarRacing-v0"
env = gym.make(environment_name)
episodes = 1
for episode in range(1, episodes+1):
state = env.reset()
done = False
score = 0
while not done:
env.render()
action = env.action_space.sample()
n_state, reward, done, info = env.step(action)
score+=reward
print('Episode: {} - Score:{}'.format(episode, str(score)[:6]))
env.close()
# 3. Train Model
print("Training our model..")
env = gym.make(environment_name)
env = DummyVecEnv([lambda: env])
log_path = os.path.join('Training', 'Logs')
model = PPO("CnnPolicy", env, verbose = 1, tensorboard_log = log_path)
model.learn(total_timesteps = 2000000)
# 4. Save/Load Model
print("Saving the model to a file..")
ppo_path = os.path.join('Training', 'Saved Models', 'PPO_2m_Driving_model_2')
model = PPO.load(ppo_path, env)
# 5 Evaluate and Test
print("Evaluating our model..")
evaluate_policy(model, env, n_eval_episodes = 10, render = True)
I tried to convert the .7z training file into .zip. The program will run normally but the car won't move at all when I add PPO_2m_Driving_model_2.zip
in load(). The car will keep losing points and it will restart the map once again repeating the same process.
Any ideas ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.