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

DQN support of custom models #6254

Closed
wants to merge 4 commits into from
Closed

DQN support of custom models #6254

wants to merge 4 commits into from

Conversation

AmeerHajAli
Copy link
Contributor

@AmeerHajAli AmeerHajAli commented Nov 24, 2019

Why are these changes needed?

Prevents circular dependency of custom models when running DQN - #6091.
I also added a test that checks internal custom models for DQN and makes sure it does not accidentally break for other policies.

Related issue number

Closes #6091

Checks

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

from ray.rllib.models.tf.misc import normc_initializer, get_activation_fn
from ray.rllib.utils import try_import_tf

tf = try_import_tf()


class FullyConnectedNetwork(TFModelV2):
class FullyConnectedNetwork(DistributionalQModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

This class is a generic model, and should not need to know about DistributionalQModel. The right place to do this is in the catalog.

We already wrap the model for the default models here:

wrapper = ModelCatalog._wrap_if_needed(v2_class, model_interface)

and just need to do it for custom models too:

if model_interface and not issubclass(model_cls,

from ray.rllib.models.tf.visionnet_v2 import VisionNetwork
from ray.rllib.models.tf.fcnet_v2 import FullyConnectedNetwork

class DQNCustomModelTest(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding a new test, can you add an case to https://github.com/ray-project/ray/blob/master/rllib/examples/custom_keras_model.py exercising this instead?

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/18821/
Test FAILed.

@AmeerHajAli
Copy link
Contributor Author

Thanks @ericl. I reverted and pushed another PR #6258 as suggested.

@ericl ericl closed this Nov 24, 2019
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.

DQN does not allow custom models
3 participants