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

Errors when saving ranking policies #891

Open
tottenjordan opened this issue Sep 28, 2023 · 1 comment
Open

Errors when saving ranking policies #891

tottenjordan opened this issue Sep 28, 2023 · 1 comment

Comments

@tottenjordan
Copy link

tottenjordan commented Sep 28, 2023

What is recommended way to save ranking policies?

For each agent policy in the ranking tutorial, im getting errors like below when trying to save with PolicySaver

saver = policy_saver.PolicySaver(
    policy = agent.policy, 
    batch_size=None
)

penalize_cosine_distance_ranking_policy error:

ValueError: Could not determine an appropriate value for field `logits` in object `tfp.distributions.CosinePenalizedPlackettLuce("PlackettLuce", batch_shape=[?], 
event_shape=[3], dtype=int32)`. Looked for 
 1. an attr called `logits`,
 2. an attr called `_logits`,
 3. an entry in `obj.parameters` with key "logits".

no_penalty_ranking_policy error:

ValueError: Could not determine an appropriate value for field `features` in object `tfp.distributions.NoPenaltyPlackettLuce("PlackettLuce", batch_shape=[?], event_shape=[50], dtype=int32)`. 
Looked for 
 1. an attr called `features`,
 2. an attr called `_features`,
 3. an entry in `obj.parameters` with key "features".

descending_score_ranking_policy error:

TypeError: To be compatible with tf.function, Python functions must return zero or more Tensors or ExtensionTypes or None values; in compilation of <function PolicySaver.__init__.<locals>.polymorphic_distribution_fn at 0x7ced7451f010>, found return value of type DescendingScoreSampler, which is not a Tensor or ExtensionType.

@SimonEOA
Copy link

SimonEOA commented Apr 3, 2024

Hi @tottenjordan I'm having a similar issue, did you ever get an answer, or find a solution?

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

No branches or pull requests

2 participants