From 82f8d6a66c908dc8bbdb243867b6d67766b641fd Mon Sep 17 00:00:00 2001 From: Konstantin Lopuhin Date: Sat, 5 Apr 2025 20:49:53 +0100 Subject: [PATCH 1/2] add API docs for llm package --- docs/requirements.txt | 1 + docs/source/autodocs/index.rst | 1 + docs/source/autodocs/llm.rst | 5 +++++ docs/source/tutorials/index.rst | 3 ++- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docs/source/autodocs/llm.rst diff --git a/docs/requirements.txt b/docs/requirements.txt index a71604a3..fa8de61f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,4 +4,5 @@ sphinx_rtd_theme ipython pandas Pillow +openai -r ../requirements.txt diff --git a/docs/source/autodocs/index.rst b/docs/source/autodocs/index.rst index 6aaa14fd..dc5065f8 100644 --- a/docs/source/autodocs/index.rst +++ b/docs/source/autodocs/index.rst @@ -16,6 +16,7 @@ API documentation is auto-generated. ./lightgbm ./catboost ./permutation_importance + ./llm ./keras ./base diff --git a/docs/source/autodocs/llm.rst b/docs/source/autodocs/llm.rst new file mode 100644 index 00000000..ef0403cb --- /dev/null +++ b/docs/source/autodocs/llm.rst @@ -0,0 +1,5 @@ +eli5.llm +======== + +.. automodule:: eli5.llm.explain_prediction + :members: diff --git a/docs/source/tutorials/index.rst b/docs/source/tutorials/index.rst index 3b2ef3af..08bdddc1 100644 --- a/docs/source/tutorials/index.rst +++ b/docs/source/tutorials/index.rst @@ -10,4 +10,5 @@ Tutorials ./black-box-text-classifiers ./xgboost-titanic ./sklearn_crfsuite - ./keras-image-classifiers \ No newline at end of file + ./explain_llm_logprobs + ./keras-image-classifiers From eed107c12178a2a36114ddebec9555215e599efa Mon Sep 17 00:00:00 2001 From: Konstantin Lopuhin Date: Sat, 5 Apr 2025 20:53:54 +0100 Subject: [PATCH 2/2] increase delay and number of retries when fetching newsgroups --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 3c30a960..591241ff 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from os.path import dirname from os.path import join import csv @@ -27,7 +26,7 @@ def _get_newsgroups(binary=False, remove_chrome=False, test=False, size=SIZE): subset = 'test' if test else 'train' data = fetch_20newsgroups(subset=subset, categories=categories, shuffle=True, random_state=42, - remove=remove) + remove=remove, n_retries=5, delay=5.0) assert data.target_names == categories return data.data[:size], data.target[:size], data.target_names @@ -51,6 +50,7 @@ def newsgroups_train_big(): def newsgroups_train_binary_big(): return _get_newsgroups(binary=True, remove_chrome=True, size=1000) + class Bunch(dict): """Container object for datasets: dictionary-like object that exposes its keys as attributes."""