Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

cache api calls and responses on setup #4565

Merged
merged 4 commits into from
Jun 2, 2022
Merged

cache api calls and responses on setup #4565

merged 4 commits into from
Jun 2, 2022

Conversation

macota
Copy link
Contributor

@macota macota commented Jun 1, 2022

Patch description
Cache api calls to responses dictionary on setup for multiwoz_v22

Testing steps
Unit tests all pass
image

Train dataset output validation:
Original output on left, new output on right
image

Test dataset output:
image

Valid dataset output:
image

Other information
Unit tests run in 1/4 the time with caching vs without
~63 seconds vs ~257 seconds

Copy link
Contributor

@moyapchen moyapchen left a comment

Choose a reason for hiding this comment

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

Logic looks right based on what we chatted about; couple of coding/safety nits.

Out of curiosity, are the numbers in the Summary from the first time loading the dataset or using the cache for subsequent calls?

parlai/tasks/multiwoz_v22/agents.py Outdated Show resolved Hide resolved
@macota
Copy link
Contributor Author

macota commented Jun 1, 2022

Out of curiosity, are the numbers in the Summary from the first time loading the dataset or using the cache for subsequent calls?

76.7 seconds on first pytest run with no presaved cache files
59.47 seconds on subsequent run

@moyapchen
Copy link
Contributor

..and which datatype is that?

@macota
Copy link
Contributor Author

macota commented Jun 1, 2022

..and which datatype is that?

unit tests cover all three looks like

@moyapchen
Copy link
Contributor

Ahhh brainfart there; eyes somehow skipped "pytest" there in "first pytest run"

Copy link
Contributor

@moyapchen moyapchen left a comment

Choose a reason for hiding this comment

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

2 tiny nits then this looks good

parlai/tasks/multiwoz_v22/agents.py Outdated Show resolved Hide resolved
parlai/tasks/multiwoz_v22/agents.py Outdated Show resolved Hide resolved
@macota macota requested a review from moyapchen June 2, 2022 19:58
Copy link
Contributor

@moyapchen moyapchen left a comment

Choose a reason for hiding this comment

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

Thanks!

@macota macota merged commit 7660197 into main Jun 2, 2022
@macota macota deleted the cache-calls branch June 2, 2022 20:03
kushalarora pushed a commit that referenced this pull request Jun 15, 2022
* cache api calls and responses on setup

* use PathManager instead of os and json instead of pickle

* fix json.load and file open

* fix typo

Co-authored-by: Martin Corredor <mcorredor@devfair0237.h2.fair>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants