File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
examples/acrobot-qtable/src/bin Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ fn main() {
7676 }
7777
7878 std:: fs:: create_dir_all ( & model_save_directory) . expect ( "Failed to create model log directory" ) ;
79-
79+
8080 print ! ( "----> loading environment and agent..." ) ;
8181 std:: io:: Write :: flush ( & mut std:: io:: stdout ( ) ) . unwrap ( ) ;
8282
@@ -102,8 +102,8 @@ fn main() {
102102 Some ( path) => QTableAgent :: load ( & path) . expect ( & format ! ( "Failed to resotore agent from Q-table file `{}`" , path. display( ) ) ) ,
103103 }
104104 } ;
105-
106- println ! ( " loaded" ) ;
105+
106+ println ! ( " ✅ loaded" ) ;
107107
108108 // initialize the qtable by randomly exploring the environment
109109 for _ in 0 ..100 {
@@ -173,10 +173,16 @@ fn main() {
173173 if episode % model_save_interval == 0 {
174174 print ! ( "----> saving current agent as a file..." ) ;
175175 std:: io:: Write :: flush ( & mut std:: io:: stdout ( ) ) . unwrap ( ) ;
176- agent
177- . save ( model_save_directory. join ( format ! ( "agent_{episode}@{}.json" , episode_reward. round( ) as usize ) ) )
178- . expect ( "Failed to save agent" ) ;
179- println ! ( " done" ) ;
176+ let filename = format ! ( "agent_{episode}@{}.json" , episode_reward. round( ) as usize ) ;
177+ let path = model_save_directory. join ( & filename) ;
178+ agent. save ( & path) . expect ( "Failed to save agent" ) ;
179+ println ! (
180+ " 📄./{}" ,
181+ path. iter( )
182+ . skip( std:: env:: current_dir( ) . unwrap( ) . iter( ) . count( ) )
183+ . collect:: <std:: path:: PathBuf >( )
184+ . display( )
185+ ) ;
180186 }
181187
182188 agent. decay_alpha_with_rate ( 0.9999 ) ;
You can’t perform that action at this time.
0 commit comments