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

[BUG] v2.0.3 DiscreteCQL loss is not a scalar #298

Closed
jdesman1 opened this issue Jul 18, 2023 · 4 comments
Closed

[BUG] v2.0.3 DiscreteCQL loss is not a scalar #298

jdesman1 opened this issue Jul 18, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jdesman1
Copy link

jdesman1 commented Jul 18, 2023

Describe the bug
The loss of DiscreteCQL is not being logged as a scalar.

To Reproduce

from d3rlpy.datasets import get_cartpole
from d3rlpy.algos import DiscreteCQLConfig
from d3rlpy.metrics import TDErrorEvaluator
from d3rlpy.metrics import EnvironmentEvaluator

dataset, env = get_cartpole()
cql= DiscreteCQLConfig().create(device=None)
cql.build_with_dataset(dataset)
td_error_evaluator = TDErrorEvaluator(episodes=dataset.episodes)
env_evaluator = EnvironmentEvaluator(env)
rewards = env_evaluator(cql, dataset=None)

cql.fit(
    dataset,
    n_steps=10000,
    evaluators={
        'td_error': td_error_evaluator,
        'environment': env_evaluator,
    },
)

Inspection of the logged CQL loss reveals it is now of form [float, float], although the tqdm display shows it as a scalar.

Expected behavior
Loss should be logged as a scalar, instead now producing a list.

Additional context
N/A

@jdesman1 jdesman1 added the bug Something isn't working label Jul 18, 2023
@jdesman1 jdesman1 changed the title [BUG] v2.0.3 DiscreteCQL loss is not a scaler [BUG] v2.0.3 DiscreteCQL loss is not a scalar Jul 18, 2023
@takuseno
Copy link
Owner

@jdesman1 I really appreciate your checks! This has been fixed at the latest commit: 62100ab . I'll wait for a couple of days before I release the next patch since it seems that I missed some bugs at this big release. Thanks!

@takuseno
Copy link
Owner

If you need, you can use the latest implementation by installing from source.

@jdesman1
Copy link
Author

Happy to help! I'll open more issues if I come across anything else.

@takuseno
Copy link
Owner

The latest patch has been released.
https://github.com/takuseno/d3rlpy/releases/tag/v2.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants