mirror of
https://github.com/ltcptgeneral/cse151b-final-project.git
synced 2024-12-26 01:59:10 +00:00
switch to notebook
This commit is contained in:
parent
83e81722d2
commit
e9622b6f68
4743
dqn_wordle.ipynb
Normal file
4743
dqn_wordle.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
|||||||
import gym
|
|
||||||
import gym_wordle
|
|
||||||
from stable_baselines3 import DQN
|
|
||||||
|
|
||||||
env = gym.make("Wordle-v0")
|
|
||||||
done = False
|
|
||||||
|
|
||||||
print(env)
|
|
||||||
|
|
||||||
model = DQN("MlpPolicy", env, verbose=1)
|
|
||||||
model.learn(total_timesteps=10000, log_interval=100)
|
|
||||||
model.save("dqn_wordle")
|
|
||||||
|
|
||||||
del model # remove to demonstrate saving and loading
|
|
||||||
|
|
||||||
model = DQN.load("dqn_wordle")
|
|
||||||
|
|
||||||
state = env.reset()
|
|
||||||
|
|
||||||
while not done:
|
|
||||||
|
|
||||||
action, _states = model.predict(state, deterministic=True)
|
|
||||||
|
|
||||||
state, reward, done, info = env.step(action)
|
|
Loading…
Reference in New Issue
Block a user