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

add support for dict outputs (select the first value) #178

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

leogagnon
Copy link
Contributor

Description

Add simple (and naive) for dictionary output of modules. Similar to how tupless were dealt with, I just select the first value of the dict. Only made changes to BaseModel. I'm not yet super familiar with the code so there might be some other modification needed.

Testing Done

It works with my model which has module dict outputs (for ZeroIntervention and LoreftIntervention). Didn't do extensive testing as this felt quite straightforward.

Checklist:

  • My PR title strictly follows the format: [Your Priority] Your Title
  • I have attached the testing log above
  • I provide enough comments to my code
  • I have changed documentations
  • I have added tests for my changes

@aryamanarora
Copy link
Collaborator

LGTM, pinging @frankaging: have you ever used modules which output dicts? Hasn't come up for me but this fix seems reasonable.

@frankaging
Copy link
Collaborator

LGTM! Later, we might want to further remove the assumption of intervening on the first element by creating field in the config to provide the intervening keyword.

@frankaging
Copy link
Collaborator

@leogagnon Thanks!

@frankaging frankaging merged commit 57a45fd into stanfordnlp:main Jul 29, 2024
2 checks passed
@leogagnon leogagnon deleted the feature/support-dict-output branch July 29, 2024 19:33
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