print acc reward
This commit is contained in:
parent
b4840596cb
commit
833fcb8978
1
justfile
1
justfile
|
@ -5,6 +5,7 @@ build:
|
||||||
build-cuda:
|
build-cuda:
|
||||||
cd pyr && cargo build --release --features cuda
|
cd pyr && cargo build --release --features cuda
|
||||||
train level:
|
train level:
|
||||||
|
python -m mlgame -f 400 -i ./ml/ml_play_pyr_test.py -i ./ml/ml_play_manual_2P.py . --sound off --level {{level}} --game_times 3 | grep Rewards
|
||||||
run level:
|
run level:
|
||||||
python -m mlgame -f 400 -i ./ml/ml_play_pyr_test.py -i ./ml/ml_play_manual_2P.py . --sound off --level {{level}} --game_times 3
|
python -m mlgame -f 400 -i ./ml/ml_play_pyr_test.py -i ./ml/ml_play_manual_2P.py . --sound off --level {{level}} --game_times 3
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -186,7 +186,6 @@ impl AIAgent {
|
||||||
// Compare the estimated rewards with the maximum expected rewards and
|
// Compare the estimated rewards with the maximum expected rewards and
|
||||||
// perform the backward step.
|
// perform the backward step.
|
||||||
let loss = huber_loss(1.0_f32)(&x, &y);
|
let loss = huber_loss(1.0_f32)(&x, &y);
|
||||||
log::trace!("loss: {:?}", loss);
|
|
||||||
self.optimizer
|
self.optimizer
|
||||||
.backward_step(&Tensor::new(&[loss], &self.device).unwrap())
|
.backward_step(&Tensor::new(&[loss], &self.device).unwrap())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -195,6 +194,8 @@ impl AIAgent {
|
||||||
self.memory.clear();
|
self.memory.clear();
|
||||||
if CONFIG.train {
|
if CONFIG.train {
|
||||||
self.var_map.save("model.bin").unwrap();
|
self.var_map.save("model.bin").unwrap();
|
||||||
|
log::info!("Rewards {}", self.accumulate_rewards as i64);
|
||||||
|
self.accumulate_rewards = 0.0;
|
||||||
log::info!("model.bin saved!");
|
log::info!("model.bin saved!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue