Skip to content

Commit

Permalink
Add readme about Redis cache
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Nov 11, 2023
1 parent 4c77f24 commit ff65d7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion yival_experiments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ file when the source type is set to "dataset". So we need to fetch it first.

## 4. run the experiment

The full experiment configuration is [here](https://github.com/Gapminder/gapminder-ai/blob/yival/yival_experiments/latest_experiment.yaml)
The full experiment configuration is [here](https://github.com/Gapminder/gapminder-ai/blob/yival/yival_experiments/experiment_latest.yaml)

To run it:

Expand All @@ -46,6 +46,15 @@ This will output a pickle file in `output/experiment_name_0.pkl` which include a

When the experiment is completed, Yival will start a web server to show the results.

### Use Redis for caching

The model compare function will cache LLM call results for the
evaluator, and by default the cache is dictionary in memory. You can
also use Redis to caching, so that it won't loss the cache when Yival
exits. To do this, uncomment the line for redis cache in the top of
`custom_configuration/model_compare.py` and set the host and password
to your redis server.

## 5. generate a result csv from output

To convert the pickle to excel file and create csv files for summary report, you can run the script in output/.
Expand Down
5 changes: 3 additions & 2 deletions yival_experiments/custom_configuration/model_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
# set this to see verbose outputs
litellm.set_verbose = True
# enable caching in the evaluator.
# litellm.cache = litellm.Cache()
litellm.cache = litellm.Cache(type="redis", host="127.0.0.1", port=6379)
litellm.cache = litellm.Cache()
# use Redis for caching: comment the line above and uncomment the line below.
# litellm.cache = litellm.Cache(type="redis", host="127.0.0.1", port=6379)


def model_compare(
Expand Down

0 comments on commit ff65d7e

Please sign in to comment.