Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tqdm issue #481

Merged
merged 1 commit into from
Nov 18, 2021
Merged

fix tqdm issue #481

merged 1 commit into from
Nov 18, 2021

Conversation

Trinkle23897
Copy link
Collaborator

#459 introduces a bug where the progress bar cannot show the last episode reward/length correctly, this PR fix that issue.

@codecov-commenter
Copy link

Codecov Report

Merging #481 (7e1061f) into master (8f19a86) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #481   +/-   ##
=======================================
  Coverage   94.04%   94.04%           
=======================================
  Files          60       60           
  Lines        3910     3910           
=======================================
  Hits         3677     3677           
  Misses        233      233           
Flag Coverage Δ
unittests 94.04% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tianshou/trainer/offpolicy.py 100.00% <100.00%> (ø)
tianshou/trainer/onpolicy.py 95.94% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f19a86...7e1061f. Read the comment docs.

Copy link
Contributor

@thkkk thkkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result["n/ep"] corresponds to episode_count in collector.py. If episode_count > 0, then the 'rew' and 'len' must exist.

@@ -117,8 +117,8 @@ def offpolicy_trainer(
env_step += int(result["n/st"])
t.update(result["n/st"])
logger.log_train_data(result, env_step)
last_rew = result['rew'] if 'rew' in result else last_rew
last_len = result['len'] if 'len' in result else last_len
last_rew = result['rew'] if result["n/ep"] > 0 else last_rew
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result["n/ep"] corresponds to episode_count in collector.py. If episode_count > 0, then the 'rew' and 'len' must exist.

@Trinkle23897 Trinkle23897 merged commit 94d3b27 into thu-ml:master Nov 18, 2021
BFAnas pushed a commit to BFAnas/tianshou that referenced this pull request May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants