diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.yaml b/.github/ISSUE_TEMPLATE/1_bug_report.yaml
index e15a7dc3f..7657b0cd9 100644
--- a/.github/ISSUE_TEMPLATE/1_bug_report.yaml
+++ b/.github/ISSUE_TEMPLATE/1_bug_report.yaml
@@ -1,6 +1,6 @@
name: Report a bug
description: Any errors that you encounter.
-labels: ['needs triage', 'bug']
+labels: ['bug']
body:
- type: markdown
attributes:
@@ -71,10 +71,7 @@ body:
Please provide details about your environment, including the following:
- OS (e.g., Linux, Windows, macOS)
value: |
-
- Current environment
-
-
+ - OS: [e.g., Linux, Windows, macOS]
validations:
required: false
diff --git a/.github/ISSUE_TEMPLATE/2_suggest_improvement.yaml b/.github/ISSUE_TEMPLATE/2_suggest_improvement.yaml
index 68bcf055a..a9c471fde 100644
--- a/.github/ISSUE_TEMPLATE/2_suggest_improvement.yaml
+++ b/.github/ISSUE_TEMPLATE/2_suggest_improvement.yaml
@@ -1,6 +1,6 @@
name: Improvement suggestion
description: Suggest an improvement, a code refactor, or deprecation
-labels: ['needs triage', 'refactor']
+labels: ['[adalflow] improvement']
body:
- type: textarea
attributes:
diff --git a/.github/ISSUE_TEMPLATE/3_feature_request.yaml b/.github/ISSUE_TEMPLATE/3_feature_request.yaml
index 8aa0bc38e..c11f05f27 100644
--- a/.github/ISSUE_TEMPLATE/3_feature_request.yaml
+++ b/.github/ISSUE_TEMPLATE/3_feature_request.yaml
@@ -1,6 +1,6 @@
name: Feature request
description: Propose a feature for this project
-labels: ["needs triage", "feature"]
+labels: ["[adalflow] new feature request"]
body:
- type: textarea
attributes:
diff --git a/.github/ISSUE_TEMPLATE/4_documenting.yaml b/.github/ISSUE_TEMPLATE/4_documenting.yaml
index a7c6e7b77..e5b77b0a5 100644
--- a/.github/ISSUE_TEMPLATE/4_documenting.yaml
+++ b/.github/ISSUE_TEMPLATE/4_documenting.yaml
@@ -1,6 +1,6 @@
name: Typos and doc fixes
description: Tell us about how we can improve our documentation and Google colab/ipynb notebooks.
-labels: ["needs triage", "docs"]
+labels: ["documentation"]
body:
- type: textarea
attributes:
diff --git a/.github/ISSUE_TEMPLATE/5_suggest_integration.yaml b/.github/ISSUE_TEMPLATE/5_suggest_integration.yaml
index f26eed2c2..819dbd6ee 100644
--- a/.github/ISSUE_TEMPLATE/5_suggest_integration.yaml
+++ b/.github/ISSUE_TEMPLATE/5_suggest_integration.yaml
@@ -1,6 +1,6 @@
-name: Feature request
+name: New integration proposal
description: Propose a new integration for this project, either db, retriever, model_client. We highly recommend you to find a POC from the provider team to work together on this.
-labels: ['needs triage', 'feature']
+labels: ['[adalflow] integration']
body:
- type: textarea
attributes:
diff --git a/.github/ISSUE_TEMPLATE/6_suggest_usecases_benchmarks.yaml b/.github/ISSUE_TEMPLATE/6_suggest_usecases_benchmarks.yaml
new file mode 100644
index 000000000..ea93a39ed
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/6_suggest_usecases_benchmarks.yaml
@@ -0,0 +1,32 @@
+name: Suggest use cases and benchmarks
+description: Propose new use cases that AdalFlow should support or benchmarks that we should compare against
+labels: ["new use cases/benchmarks"]
+body:
+ - type: textarea
+ attributes:
+ label: Description & Motivation
+ description: A clear and concise description of the new use case or benchmark proposal
+ placeholder: |
+ Please outline the motivation for the proposal.
+
+
+ - type: textarea
+ attributes:
+ label: Pitch
+ description: A clear and concise description of what you want to happen.
+ validations:
+ required: false
+
+ - type: textarea
+ attributes:
+ label: Alternatives
+ description: A clear and concise description of any alternative solutions or features you've considered, if any.
+ validations:
+ required: false
+
+ - type: textarea
+ attributes:
+ label: Additional context
+ description: Add any other context or screenshots about the feature request here.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index ad44518c2..065ad099b 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
+ - name: π Upvote an issue
+ url: https://github.com/SylphAI-Inc/AdalFlow/issues
+ about: You should upvote an issue if it is important to you.
- name: π¬ Chat with us
url: https://discord.gg/ezzszrRZvT
about: Live chat with experts, engineers, and users in our Discord community.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..11b273776
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,38 @@
+## What does this PR do?
+
+
+
+Fixes #\
+
+
+
+
+ Before submitting
+
+- Was this **discussed/agreed** via a GitHub issue? (not for typos and docs)
+- [ ] Did you read the [contributor guideline](https://adalflow.sylph.ai/contributor/index.html)?
+- [ ] Did you make sure your **PR does only one thing**, instead of bundling different changes together?
+- Did you make sure to **update the documentation** with your changes? (if necessary)
+- Did you write any **new necessary tests**? (not for typos and docs)
+- [ ] Did you verify new and **existing tests pass** locally with your changes?
+- Did you list all the **breaking changes** introduced by this pull request?
+
+
+
+
+
+
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ecf5b0704..6f85a6c80 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,13 +14,24 @@ repos:
hooks:
- id: black
args: ['--line-length=88']
+ exclude: ^docs/|.*\.(json|yaml|md|txt)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
# Run the linter.
- id: ruff
- args: ['--fix', '--extend-ignore=E402']
+ args: ['--fix']
+ exclude: ^docs/|.*\.(json|yaml|md|txt)$
+
+ # Add local hooks to run custom commands
+ - repo: local
+ hooks:
+ - id: run-make-format
+ name: Run Make Format
+ entry: make format
+ language: system
+ pass_filenames: false
# - repo: https://github.com/pycqa/flake8
# rev: 4.0.1
# hooks:
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..3670e02f6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,51 @@
+# Define variables for common directories and commands
+PYTHON = poetry run
+SRC_DIR = .
+
+# Default target: Show help
+.PHONY: help
+help:
+ @echo "Available targets:"
+ @echo " setup Install dependencies and set up pre-commit hooks"
+ @echo " format Run Black and Ruff to format the code"
+ @echo " lint Run Ruff to check code quality"
+ @echo " test Run tests with pytest"
+ @echo " precommit Run pre-commit hooks on all files"
+ @echo " clean Clean up temporary files and build artifacts"
+
+# Install dependencies and set up pre-commit hooks
+.PHONY: setup
+setup:
+ poetry install
+ poetry run pre-commit install
+
+# Format code using Black and Ruff
+.PHONY: format
+format:
+ $(PYTHON) black $(SRC_DIR)
+ git ls-files | xargs pre-commit run black --files
+
+# Run lint checks using Ruff
+.PHONY: lint
+lint:
+ $(PYTHON) ruff check $(SRC_DIR)
+
+# Run all pre-commit hooks on all files
+.PHONY: precommit
+precommit:
+ $(PYTHON) pre-commit run --all-files
+
+# Run tests
+.PHONY: test
+test:
+ $(PYTHON) pytest
+
+# Clean up temporary files and build artifacts
+.PHONY: clean
+clean:
+ rm -rf .pytest_cache
+ rm -rf .mypy_cache
+ rm -rf __pycache__
+ rm -rf build dist *.egg-info
+ find . -type d -name "__pycache__" -exec rm -r {} +
+ find . -type f -name "*.pyc" -delete
diff --git a/README.md b/README.md
index 04ec9a5ac..61e411fb1 100644
--- a/README.md
+++ b/README.md
@@ -76,8 +76,21 @@ For AI researchers, product teams, and software engineers who want to learn the
+# Quick Start
+Install AdalFlow with pip:
+
+```bash
+pip install adalflow
+```
+
+Please refer to the [full installation guide](https://adalflow.sylph.ai/get_started/installation.html) for more details.
+
+
+* Try the [Building Quickstart](https://colab.research.google.com/drive/1TKw_JHE42Z_AWo8UuRYZCO2iuMgyslTZ?usp=sharing) in Colab to see how AdalFlow can build the task pipeline, including Chatbot, RAG, agent, and structured output.
+* Try the [Optimization Quickstart](https://colab.research.google.com/github/SylphAI-Inc/AdalFlow/blob/main/notebooks/qas/adalflow_object_count_auto_optimization.ipynb) to see how AdalFlow can optimize the task pipeline.
+
# Why AdalFlow
@@ -111,6 +124,8 @@ Here is an optimization demonstration on a text classification task:
Among all libraries, AdalFlow achieved the highest accuracy with manual prompting (starting at 82%) and the highest accuracy after optimization.
+
+
Further reading: [Optimize Classification](https://adalflow.sylph.ai/use_cases/classification.html)
## Light, Modular, and Model-Agnostic Task Pipeline
@@ -127,6 +142,14 @@ You have full control over the prompt template, the model you use, and the outpu
+Many providers and models accessible via the same interface:
+
+
+
+
+
+[All available model providers](https://adalflow.sylph.ai/apis/components/components.model_client.html)
+
@@ -175,23 +177,7 @@ make html
And you will be able to find the newly added use_cases module.
-### Add New Docs
-
-If you want to add any written files such as README.md to the documentation, there is an easy way to transform the files to `.rst` files using `Pandoc`.
-
-- First, install Pandoc with Homebrew:
-
- `brew install pandoc`
-- Then run `pandoc -s -o `. For example, in the root directory run `pandoc -s README.md -o docs/source/get_started/introduction.rst`.This command will take content from `README.md` and create an `introduction.rst` file in the specified directory.
-
-After editing, run
-
-```python
-cd docs
-make clean
-make html
-```
### Commit the Edited Documentation
@@ -199,7 +185,7 @@ Remember to exclude any unnecessary files in `.gitignore`. Please donβt commit
Please push your updates to the GitHub repo.
-The structure of the code base and the docs:
+The structure of the docs directory looks like this:
```
AdalFlow/
@@ -227,12 +213,25 @@ AdalFlow/
β βββ conf.py
β βββ index.rst
β βββ Makefile
-βββ core/
-β βββ __init__.py
-β βββ module1.py
-β βββ module2.py
-βββ components/
-β βββ __init__.py
-β βββ module1.py
-β βββ module2.py
+β βββ pyproject.toml
+β βββ poetry.lock
+```
+
+
+## [Optional] Convert Markdown to reStructuredText
+
+If you want to add any written files such as README.md to the documentation, there is an easy way to transform the files to `.rst` files using `Pandoc`.
+
+- First, install Pandoc with Homebrew:
+
+ `brew install pandoc`
+
+- Then run `pandoc -s -o `. For example, in the root directory run `pandoc -s README.md -o docs/source/get_started/introduction.rst`.This command will take content from `README.md` and create an `introduction.rst` file in the specified directory.
+
+After editing, run
+
+```python
+cd docs
+make clean
+make html
```
diff --git a/docs/requirements.txt b/docs/requirements.txt
index e59cca034..14ce30d7b 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -8,4 +8,4 @@ PyYAML
readthedocs-sphinx-search==0.3.2
numpy
tqdm
-tiktoken
\ No newline at end of file
+tiktoken
diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css
index 95445edc9..73ee6a04c 100644
--- a/docs/source/_static/css/custom.css
+++ b/docs/source/_static/css/custom.css
@@ -344,4 +344,4 @@ table tr:hover {
font-size: 8px;
/* Further adjust text size for smallest screens */
}
-}
\ No newline at end of file
+}
diff --git a/docs/source/_static/images/adalflow_code_samples.png b/docs/source/_static/images/adalflow_code_samples.png
new file mode 100644
index 000000000..9a3bf3c2e
Binary files /dev/null and b/docs/source/_static/images/adalflow_code_samples.png differ
diff --git a/docs/source/_static/images/adalflow_files.png b/docs/source/_static/images/adalflow_files.png
new file mode 100644
index 000000000..bcffa12b7
Binary files /dev/null and b/docs/source/_static/images/adalflow_files.png differ
diff --git a/docs/source/_static/images/adalflow_issue_template.png b/docs/source/_static/images/adalflow_issue_template.png
new file mode 100644
index 000000000..9a85ec448
Binary files /dev/null and b/docs/source/_static/images/adalflow_issue_template.png differ
diff --git a/docs/source/_static/images/adalflow_issues.png b/docs/source/_static/images/adalflow_issues.png
new file mode 100644
index 000000000..527c3a0f7
Binary files /dev/null and b/docs/source/_static/images/adalflow_issues.png differ
diff --git a/docs/source/_static/images/multi-providers.png b/docs/source/_static/images/multi-providers.png
new file mode 100644
index 000000000..291b69f33
Binary files /dev/null and b/docs/source/_static/images/multi-providers.png differ
diff --git a/docs/source/_static/images/pr_draft.png b/docs/source/_static/images/pr_draft.png
new file mode 100644
index 000000000..38eca9a5e
Binary files /dev/null and b/docs/source/_static/images/pr_draft.png differ
diff --git a/docs/source/apis/index.rst b/docs/source/apis/index.rst
index 13d19ff93..7c124c748 100644
--- a/docs/source/apis/index.rst
+++ b/docs/source/apis/index.rst
@@ -1,3 +1,5 @@
+.. _apis:
+
API Reference
=============
diff --git a/docs/source/contributor/contribute_to_code.rst b/docs/source/contributor/contribute_to_code.rst
index 185e23bb5..1fe1ca6e2 100644
--- a/docs/source/contributor/contribute_to_code.rst
+++ b/docs/source/contributor/contribute_to_code.rst
@@ -1,11 +1,12 @@
-Coding and Testing
+Development Essentials
======================================
-This document will cover how you can contribute to lightRAG codebase.
+This document will cover how you can set up the AdalFlow codebase and start coding, testing, and documentation.
Set Up
^^^^^^^^^^^^^^^^^^^
-The current ``LightRAG`` code contribution supports `poetry `_ setup only. The team is working on optimizing the library and will get back to support more environment soon.
-If you are only interested in using ``LightRAG`` as a package, please check our `installation guide `_.
+We mainly use `poetry `_ for dependency management and virtual environment setup.
+
+.. If you are only interested in using ``LightRAG`` as a package, please check our `installation guide `_.
To set up ``poetry`` and contribute, please check the following steps:
@@ -13,11 +14,45 @@ To set up ``poetry`` and contribute, please check the following steps:
.. code-block:: bash
- git clone https://github.com/SylphAI-Inc/LightRAG
- cd LightRAG
+ git clone https://github.com/SylphAI-Inc/AdalFlow
+ cd AdalFlow
+
+2. **Set Up the AdalFlow Dev Environment:**
+ The AdalFlow source code, tests, and dependencies are in the ``./adalflow`` directory.
+ The ``./adalflow/pyproject.toml`` controls the dependencies for the ``adalflow`` package.
+ Use Poetry to install the dependencies and set up the virtual environment:
+
+ .. code-block:: bash
+
+ cd adalflow
+ poetry install
+ poetry shell
+
+ Test the setup by running the tests at the ``./adalflow`` directory:
+
+ .. code-block:: bash
+
+ pytest tests
+
+3. **Set Up the Root Dev Environment:**
+ At the root directory, we have a ``pyproject.toml`` file that controls the dependencies for the root directory.
+
+ .. code-block:: bash
+
+ poetry install
+ poetry shell
+
+ This will install all relevant dependencies and the files in /use_cases, /tutorials, and /benchmarks will be using the development version of the ``adalflow`` package.
+ You should see output similar to the following:
+
+ .. code-block:: bash
+
+ - Installing adalflow (0.2.5 /Users/liyin/Documents/test/AdalFlow/adalflow)
+
-2. **Configure API Keys:**
+
+4. **[Optional] Configure API Keys in the Root Directory:**
Copy the example environment file and add your API keys:
.. code-block:: bash
@@ -31,50 +66,46 @@ To set up ``poetry`` and contribute, please check the following steps:
# COHERE_API_KEY=YOUR_API_KEY_IF_YOU_USE_COHERE
# HF_TOKEN=YOUR_API_KEY_IF_YOU_USE_HF
-3. **Install Dependencies:**
-
- The ``./lightrag/pyproject.toml`` controls the dependencies for the ``LightRAG`` package.
- Use Poetry to install the dependencies and set up the virtual environment:
+ This will be helpful for you to run tutorials, use cases, and benchmarks.
- .. code-block:: bash
- cd lightrag
- poetry install
- poetry shell
-Codebase Structure
+Coding
^^^^^^^^^^^^^^^^^^^
-It is recommended to check our `LightRAG codebase structure `_ and current `API references `_ to familiarize yourself with the directories and paths before contributing.
+Structuring
+~~~~~~~~~~~~~~~
+It is recommended to check our the structuring in :ref:`part1-structuring` and :doc:`../apis/index`
+to understand the codebase structure.
-Code Examples
-^^^^^^^^^^^^^^^^^^^
-We want to support you with our best. We have included code samples in the `tutorial `_ for you to refer to.
+What to code
+~~~~~~~~~~~~~~~
+Please check the :ref:`part3-contributing-steps` to see some coding examples and steps to contribute to the codebase.
-We inlcude a list of potential samples(`We are working in progress to add more`):
+Code Tips
+~~~~~~~~~~~~~~~
+* Please follow the `Google Python Style Guide `_.
-- `ModelClient integration `_. This document will help if you want to add new models not included in our codebase.
-- `Retriever Integration `_. We provide different retrivers but you can create more.
+* Functions and classes should include standard docstrings and comments. Please refer to `documentation contribution guidelines <./contribute_to_document.html>`_ for standard docstrings.
-Code Tips
-^^^^^^^^^^^^^^^^^^^
-* When writing code, it is appreciated to include any important docstrings and comments. Please refer to `documentation contribution guidelines <./contribute_to_document.html>`_ for standard docstrings.
-* LightRAG is a Python library and if you could follow the `Google Python Style Guide `_, the codebase will be more consistent.
+Copilot
+~~~~~~~~~~~~~~~
+We suggest you use `GitHub Copilot `_ to help you write code faster and more efficiently.
+You can follow this `Guide `_ to set it up with your IDE.
+There are other options like `Cursor `_ and `Tabnine `_ that you can use as well.
Dependencies
-^^^^^^^^^^^^^^^^^^^
-If you want to add any new dependencies to the package, please include them in your PR description to inform us.
-Since we have already set up the testing automatic workflow in GitHub, please also set your new dependencies in
-``./lightrag/pyproject.toml`` file ``[tool.poetry.group.test.dependencies]`` section to avoid dependency errors in our CI/CD workflow.
-
-In order to correctly add the dependency using ``poetry``, please run
+~~~~~~~~~~~~~~~
+1. If you want to add any new dependencies to the package, please include them in your PR description to inform us.
+2. Since we have already set up the testing automatic workflow in GitHub, please also set your new dependencies in ``./adalflow/pyproject.toml`` file ``[tool.poetry.group.test.dependencies]`` section to avoid dependency errors in our CI/CD workflow.
+ In order to correctly add the dependency using ``poetry``, please run
-.. code-block:: bash
+ .. code-block:: bash
- poetry add --group test
+ poetry add --group test
Testing
^^^^^^^^^^^^^^^^^^^
After you update the code, please make sure your code is well tested before making a pull request.
-There is a ``./lightrag/tests`` folder in the project directory to host your unit testing cases.
+There is a ``./adalflow/tests`` folder in the project directory to host your unit testing cases.
You might need to install the testing packages using ``poetry``:
@@ -82,13 +113,27 @@ For example:
.. code-block:: bash
- poetry add --group test unittest
- poetry add --group test pytest
- poetry add --group test mypy
+ poetry install # or
+ poetry add --group test
+
+
+You should name your test files with the following format: ``test_.py``.
+
+Activate the virtual environment from `./adalflow` and run the tests:
+.. code-block:: bash
+
+ poetry shell
+ pytest
-All the test scripts should start with ``test_``. For example, run the individual test for ``components`` with:
+To run a specific test file, you can use the following command:
.. code-block:: bash
- python lightrag/tests/test_components.py
+ pytest tests/test_components.py
+
+For more details on testing, please refer to the `README.md `_ under the ``./adalflow/tests`` directory.
+
+Documentation
+^^^^^^^^^^^^^^^^^^^
+Please refer to the `README.md `_ under the ``./docs`` directory for more details on how to contribute to the documentation.
diff --git a/docs/source/contributor/contribute_to_document.rst b/docs/source/contributor/contribute_to_document.rst
deleted file mode 100644
index bfe270309..000000000
--- a/docs/source/contributor/contribute_to_document.rst
+++ /dev/null
@@ -1,114 +0,0 @@
-Documenting
-===============================================
-
-.. contents::
- :local:
- :depth: 2
-
-.. _Documentation Contribution:
-
-- **User-Facing Documentation**: Found on the main docs site. These include tutorials, guides, and usage documentation meant for end users.
-- **Developer Documentation**: Located within the repository's READMEs and the ``docs/`` directory. These documents are more technical and intended for contributors and maintainers.
-
-This section is about user-facing documentation.
-
-LightRAG uses `Sphinx `_ for documentation, leveraging both `reStructuredText `_ and Sphinx's `autodoc `_ feature to pull docstrings from code and organize them through ``.rst`` files. Our documentation is split into:
-
-Souce Code Docstring Standard
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Sphinx automatically pulls docstrings from source code and uses them as the docs in API reference. For clarity and consistency, we have a standard for all the code contributors.
-
-Aligning with Pytorch, LightRAG uses the `Google style with Sphinx `_ for formatting docstrings `(detailed styles) `_, emphasizing **docstring** and **type control** to guarantee the document and code quality.
-
-
-Setup & Build Documentation
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-**1. Clone the GitHub Project**
-
-.. code-block:: bash
-
- git clone https://github.com/SylphAI-Inc/LightRAG.git
-
-**2. Install Necessary Packages**
-
-LightRAG's documentation style is `pydata_sphinx_theme `_.
-
-.. Install by ``pip``:
-
-.. .. code-block:: bash
-
-.. cd docs
-.. pip install -r requirements.txt
-
-Install by ``poetry`` along with all other dependencies for LightRAG:
-
-.. code-block:: bash
-
- poetry install
-
-**3. Build the Documentation**
-
-.. code-block:: bash
-
- cd docs
- make html
-
-
-**conf.py**
-
-This file (``docs/source/conf.py``) contains configurations used by Sphinx, including extensions, templates, HTML theme, and language settings.
-
-**Source Code Doc-string**
-
-Follow `Google style docstrings `_ to update your source code docstrings. Limit lines to **80** characters for better readability in various environments.
-
-**RST Files**: Directly edit ``.rst`` files for broader changes or new sections. Use the ``.. toctree::`` directive to link documents.
-
-The ``.rst`` files are in the ``docs/source``. The majority of ``.rst`` files in the ``docs/source/apis`` are generated automatically from the Python code docstrings using ``sphinx-apidoc``.
-
-To shorten the doc generating process, please remove the files that is not included in your project.
-
-The Sphinx build will show warnings but the docs will still be completed.
-
-If you have a module folder containing code, for example, ``components/``, please add the following line to the ``docs/Makefile`` in the ``apidoc:`` section.
-
-.. code-block:: bash
-
- @sphinx-apidoc -o $(APIDOCOUTDIR)/components ../components --separate --force
-
-
-**4. View the Documentation Locally**
-
-After building, open ``docs/build/html/index.html`` in a web browser. If you face issues with local resources, such as the browser prohibits loading the web page correctly, run a local server:
-
-.. code-block:: bash
-
- cd docs/build
- python -m http.server 8000
-
-Then navigate to the corresbonding site in your browser. E.g. it can be `http://127.0.0.1:8000/`.
-
-
-
-Adding Documentation Tests
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-To ensure the documentation remains up-to-date, LightRAG uses Sphinx's Doctest extension. Add ``.. testcode::`` to your ``.rst`` files or docstrings and run ``make doctest`` to test your documentation snippets.
-
-To manually run these tests, run:
-
-.. code-block:: bash
-
- cd docs
- make doctest
-
-
-Documentation Dependencies
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If your documentation requires any new dependencies, please include it in the ``pyproject.toml`` under the root directory, include it in your PR description and let us know.
-
-Commit Changes
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-After making changes, commit the ``.rst`` and source files, avoiding the ``docs/build`` directory, and push them to your GitHub fork for review.
diff --git a/docs/source/contributor/contribution.rst b/docs/source/contributor/contribution.rst
index 8656877a0..f1c0394ce 100644
--- a/docs/source/contributor/contribution.rst
+++ b/docs/source/contributor/contribution.rst
@@ -1,83 +1,473 @@
-Overall contributing process
+Contributing Process
=======================================
+Welcome to the AdalFlow community!
-Welcome to the AdalFlow community! We're building the most user-friendly, modular library for building and auto-optimizing LLM applications, from Chatbots, RAGs, to Agents.
-Think of AdalFlow to LLM applications and in-context learning is like PyTorch/TensorFlow/JAX for AI modeling.
-The goal is to provide basic and foudamental building blocks to build advanced applications with auto-optimization out-of-the-box.
-As we mature, we might see more RAG, memory-based chatbots, or agents frameworks will be built on top of AdalFlow building blocks such as retriever, generator.
+We tried to make the process simple and clear, but it can always improve.
+Share your suggestions on `Discord `_ or `Github Discussion `_.
-We highly suggest you to read our :ref:`design principle` before you start contributing.
-We only accept high quality contribution.
-We appreciate contributors but we have to hold our libary responsible for users.
-Once you decide to contribute, we hope you are not just to list your name on the repo, but more importantly, you learn and improve your own skills! you support your faviroty projects and community!
+Quick Start
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1. The `Github issues `_ is the best place to find your first task. Look for tasks labeled `good first issue`.
+2. Follow the :doc:`./contribute_to_code` to set up your environment and start coding, testing, and documenting.
+3. Review the `PR & Review Process <#pr-review-process>`_ to complete the review and iteration process.
+ We aim to maximize both your learning and the library's quality.
+
+
+.. note::
+
+ You can use π to show that you want a particular issue to be addressed.
+
+.. _part1-structuring:
+Part 1: Structuring
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+To dive deeper, weβll explain our repository structure, issue tracking, and label system.
+
+.. what to contribute(with examples), contributing steps with proposal/discussion/coding/testing/documentation/pr/review process.
+.. The coding and testing will be discussed more in details in `Code Contribution Guidelines <./contribute_to_code.html>`_ and the documentation will be discussed in `Documentation Contribution Guidelines <./contribute_to_document.html>`_.
+
+Repo Structure
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Our repository has a clear structure, divided into six subdirectories:
+
+.. code-block:: text
+
+ .
+ βββ .github/
+ βββ adalflow/
+ β βββ adalflow/
+ β βββ tests/
+ | βββ pyproject.toml
+ βββ docs/
+ | |ββ pyproject.toml
+ βββ tutorials/
+ βββ use_cases/
+ βββ benchmarks/
+ βββ notebooks/
+ | βββ tutorials/
+ | βββ use_cases/
+ | βββ benchmarks/
+ βββ .env_example
+ βββ .gitignore
+ βββ .pre-commit-config.yaml
+ βββ LICENSE.md
+ βββ README.md
+ βββ poetry.lock
+ βββ pyproject.toml
+
+1. The ``/adalflow`` directory contains the source code for the `AdalFlow` library,including its implementation, tests, and a dedicated `pyproject.toml` file.
+2. The ``/docs`` directory houses the documentation for the `AdalFlow` library and also includes its own `pyproject.toml` file.
+ We use `reStructuredText` for the documentation. For more details, please refer to `README.md `_ under the ``./docs`` directory.
+3. Additionally, it includes the following directories:
+
+ - ``/tutorials``: Contains tutorials for the `AdalFlow` library, for each core feature or class.
+ - ``/use_cases``: Covers various use cases, likely end to end applications even with auto-optimization.
+ - ``/benchmarks``: Includes benchmarks to evaluate the library with other libraries or frameworks.
+4. ``/notebooks`` directory contains all notebooks used across `tutorials`, `use_cases`, and `benchmarks`.
+
+
+
+Issue & Label System
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+We use issues to manage bugs, features, and discussions.
+To organize them, weβve carefully designed **15** labels.
+
+
+.. figure:: ../_static/images/adalflow_issues.png
+ :alt: AdalFlow Issues
+ :align: center
+ :width: 700px
+
+ **Type**: The type of the issue, such as bug, feature, or discussion.
+
+We use three categories of labels in parallel:
+
+* Type of issue: There are 7 types of issues.
+
+ - ``[adalflow]`` indicates the issue relates to `AdalFlow` source code in the ``/adalflow`` directory.
+ Within this directory, the ``/adalflow`` contains the source code, and the ``/tests`` contains test code.
+ 3 labels here include: ``integration``, ``improvement``, ``core feature``.
+
+ - We use ``bug`` for code-related issues across all directories.
+ - ``documentation`` for items in the ``/docs``, ``/tutorials``, ``/use_cases``, ``/benchmarks``, and ``/notebooks`` directories.
+ - ``new use cases/benchmarks`` for issues in ``/use_cases`` and ``/benchmarks``.
+ - ``question`` for general inquiries.
+
+* How to proceed: There are 4 labels.
+
+ - ``good first issue`` for tasks suitable for new contributors.
+ - ``wontfix`` for issues that wonβt be addressed in the library.
+ - ``duplicate`` for issues already tracked elsewhere.
+ - ``help wanted`` indicates priority signal, discussion, and pr are needed.
+
+* Priority: There are 3 levels.
+
+ - ``P0`` for the highest priority issues.
+ - ``P1`` for medium priority.
+ - ``P2`` for the lowest priority.
+
+
+.. note::
+ * All the above 14 labels can be used for both issues and PRs.
+ * ``ready-for-pr`` is exclusive to issues and indicates the issue is ready for a PR.
+ * ``ready-to-go`` is exclusive to PRs and indicates the PR is ready to be merged.
+
+This following table will provide a quick overview of them all.
+
+
+.. list-table:: Label overview
+ :header-rows: 1
+ :widths: 40 50 30
+
+ * - Type of issue (7 labels)
+ - How to proceed (3 labels)
+ - Priority (3 labels)
+ * - [adalflow] suggest integration
+ -
+ -
+ * - [adalflow] suggest improvement
+ - wontfix
+ - P0
+ * - [adalflow] suggest core feature
+ - good first issue
+ -
+ * - new use cases/benchmarks
+ - duplicate (aggregate) and close one
+ - P1
+ * - [adalflow] bug
+ - help wanted
+ - P2
+ * - question
+ - ``ready-for-pr``
+ -
+ * - documentation
+ - ``ready-to-go``
+ -
-It took us 3 months to setup a contributing guide, as we did explore with users and think a lot on how to organize labels and what is the best process that can control the quality of our library while leveraing the open-source community. **We will continously improve our process and we welcome any suggestion and advice.**
-We are determined to make AdalFlow as great and legendary as PyTorch.
+How to create an issue
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Weβve created five templates to make it easy for you to create an issue.
-.. ``LightRAG``'s contribution process is similar to most open source projects on GitHub. We encourage new project ideas and the communication between ``LightRAG`` team, developers and the broader community.
-.. Please don't forget to join us on `Discord `_.
+.. figure:: ../_static/images/adalflow_issue_template.png
+ :alt: AdalFlow Issue Template
+ :align: center
+ :width: 700px
-.. toctree::
- :maxdepth: 2
+ Five templates for creating issues
- contribution_process
- contribute_to_code
- contribute_to_document
+Each template automatically assigns relevant labels to the issue.
-Contribution Process
-----------------------------
-You are always welcomed to contribute even if you've never participated in open source project before.
-Here is the basic contribution process:
-Environment
+How to assign priority
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+While our team marks priorities based on our best judgment, we also welcome community input to help us prioritize issues.
+
+You can use π to indicate how important a particular issue is to you.
+Weβll consider the ``# of π / time_period`` as an additional signal for setting priorities.
+
+
+
+Part 2: What to contribute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When contributing, please note:
-LightRAG separates the source code environment and documentation environment.
-* To activate the code environment, you should run ``poetry install`` and ``poetry shell`` under ``./lightrag``. The ``./lightrag/pyproject.toml`` contains the dependencies for the ``LightRAG`` package.
+This section provides more details on how each issue relates to our codebase.
+Weβll include example PRs to help clarify these connections.
+
+The following table offers a quick overview.
+More details on each type of contribution in Part 3.
+
+.. list-table:: What to Contribute (by 7 Labels) and Example PRs
+ :header-rows: 1
+ :widths: 20 50 30
+
+ * - Label
+ - Contribution Suggestions
+ - Example Issue/PR
+ * - [adalflow] bug
+ - Fix bugs reported in issues, can relate to /adalflow code or /tutorials/user_cases/benchmarks.
+ - `Issue 134 `_ and `PR 135 `_
+ * - [adalflow] suggest integration
+ - Add new integrations with model inference SDKs (:ref:`model_client`) or database retrievers (:ref:`retriever`) or tools or other libraries/frameworks.
+ - `Ollama integration request `_ and `PR 97 `_. This often involves tests, tutorial, and documentation.
+ * - [adalflow] suggest improvement
+ - Enhance existing features for better performance or usability, can relate to /adalflow code or /tutorials/user_cases/benchmarks.
+ - `Stream the response request `_ and `PR 158 `_.
+ * - [adalflow] suggest core feature
+ - Develop **new** core functionalities in `/adalflow` directory, such as `text_splitter` or `memory`.
+ -
+ * - new use cases/benchmarks
+ - Design benchmarks or propose new use cases for `adalflow`.
+ -
+ * - documentation
+ - Improve existing documentation under `/docs` or `/notebooks` directories or create new documentation for existing code.
+ - `Issue 194 `_, `Issue 123 `_, and `PR 260 `_.
+ * - question
+ - Answer user queries or provide clarifications about the library.
+ -
-* To activate the documentation environment, you can run ``poetry install`` and ``poetry shell`` under ``.``. The ``./pyproject.toml`` controls documentation dependencies.
+.. _part3-contributing-steps:
-Find a direction to work on
+Part 3: Contributing Steps
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The team builds ``LightRAG`` based on latest researches and product cases. But you might have your own task to apply ``LightRAG``.
-Therefore, you can extend ``LightRAG`` and add any new features you believe will solve yours or others' problems.
-If you don't have any idea yet, you can:
-* Check the `existing issues `_ and see if there is anyone you know how to fix or you'd love to fix.
+Once you know what you want to contribute, follow these steps to ensure the quality of your contribution:
+
+1. **Track it.** Create an issue if it doesnβt already exist.
+2. **Learn enough context.** Read the relevant documentation and code inside and outside of AdalFlow.
+ This includes:
+
+ - :ref:`tutorials`
+ - :ref:`use_cases`
+ - :ref:`API references`
+ - tests within `/adalflow/tests` to understand everything you need to know.
+
+ This will help you understand everything necessary for your contribution.
+ Weβll provide examples for each type of contribution in the next section.
+
+ - For integration, you need to know the relevant SDKs and APIs.
+ - For documentation, you need to know the structure of the documentation and the writing style.
+
+3. **Create a solution proposal and gather input.** Write your solution proposal in the issue comments.
+ Alternatively, you can use a publically accessible tool like ``Google Doc`` or ``Colab`` to share your proposal.
+ The `AdalFlow` team and the community will review and provide feedback before your start coding.
+ The team and core contributors can label it as ``ready-for-pr`` when it is ready for a PR.
+ This step is especially crucial for complex features. You can also discuss your proposal on our `Discord `_.
+
+4. **Work on it.** Follow the `PR & Review Process <#pr-review-process>`_ to begin coding, testing, documenting, and reviewing.
+
+
+.. TODO: edit the remaining content
+
+Integrate a model_client
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+All existing :ref:`model clients` are located in the `/adalflow/adalflow/components/model_client` directory.
+The tutorial :ref:`model_client` will help you understand the base class and how it is designed.
+
+In general, `OpenAI SDK `_ is trending to the the industry standard.
+And you can measure your targetting SDKs by the difference between these two.
+But overall, the OPENAI integration consists of: coding, testing, documentation.
+
+Coding includes:
+
+1. A :ref:`OpenAIClient` class that inherits from the base class :ref:`ModelClient`.
+2. Add the `sdk package` as an optional package in the `adalflow/pyproject.toml` file.
+3. Add the `sdk package` as lazy import in the `adalflow/adalflow/utils/lazy_import.py` file.
+4. Call the lazy import in the `adalflow/adalflow/components/model_client/__init__.py` file.
+5. Import the new client in the `adalflow/adalflow/__init__.py` file so that we can call it directly from the `adalflow` package.
+
+Testing includes:
+
+1. Create a test file `test_XX_client.py` in the `adalflow/tests/` directory. You can use `test_openai_client.py` as a reference.
+2. Add the package to the `adalflow/pyproject.toml` file under the `[tool.poetry.group.test.dependencies]` section.
+3. Add the test case for the new client in the test file.
+4. Follow the `adalflow/tests/README.md` to run the test.
+
+Documentation includes:
+
+1. Add examples on how to use the new client in the `tutorials` directory. You can use `tutorials/ollama_client_note.py` as a reference.
+2. Make sure you add the new client package in the root `pyproject.toml` file under the `[tool.poetry.dependencies]` section.
+3. Ensure the API reference is correctly rendenered in the `docs` directory.
+ For example, with `ollama_client`, you need to add the following line in the `docs/source/apis/components/index.rst` file:
+
+ .. code-block:: text
+
+ components.model_client.ollama_client
+
+4. Add examplary API configurations in the root `.env_example` file.
+
+
+This `ollama_client PR `_ is a good example of how to integrate a new model client.
+
+Integrate a database retriever
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+All existing :ref:`retrievers` are located in the `/adalflow/adalflow/components/retriever` directory.
+The tutorial :ref:`retriever` will help you understand the base class and how it is designed.
+
+The process is quite similar to integrating a model client. For documentation, ensure you add an example in :ref:`retriever`.
-* Join us on `Discord `_. We are glad to discuss with you and know what you are interested in here.
+This `qdrant_retriever PR `_ is a good example of how to integrate a new database retriever.
-Figure out the scope of your change
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-**Small:** Most of the pull requests are small. If your change is small, such as fixing a line of bug, please go ahead to push it.
+Add notebooks for existing/new tutorials/use_cases/benchmarks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**Big:** But if you are making a new feature, or planning to push a large change, it is recommended to contact us on `Discord `_ first.
+.. figure:: ../_static/images/adalflow_code_samples.png
+ :alt: Code samples for tutorials
-**Unknown:** If you have no idea how big it will be, we are here to help you. Please post your idea on `issues `_. We will read it carefully and get back to you.
+ :align: center
+ :width: 700px
-Add your code
+ Code samples for tutorials
+
+
+.. note::
+ For how to add a new notebook, please follow the `README.md `_ in the `notebooks` directory.
+
+**Tutorials**
+
+For :ref:`tutorials` in our documentation, each tutorial is accompanied by two code files: one `XX_note.py` in `/tutorials` and one `adalflow_XX.ipynb` in `/notebooks/tutorials`.
+You can help add the missing code file in tutorials and make sure to link them in the documentation like the above figure.
+Here is one example issue and PR for adding a new tutorial: `Issue 192 `_ and `PR 261 `_.
+
+**Use Cases**
+
+For :ref:`use_cases` in our documentation, each use case is accompanied by source code in `/use_cases` and a notebook in `/notebooks/use_cases`.
+For our existing use cases, we do not always have the corresponding notebooks. You can help add the missing notebooks for the existing use cases.
+
+**Benchmarks**
+
+So far, we are still working on the code in the `/benchmarks` directory. We will need help on addint the documentation along with the code.
+
+Part 4: Pull Request Process
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Please check our `code contribution guidelines <./contribute_to_code.html>`_ to work with code.
-Pull requests
+Prepare the codebase
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Before you can start a pull request, you need to follow these steps and this `Github official fork guide `_:
+
+1. **Fork the repository.**
+ You can fork the repository by clicking the `Fork` button on the top right corner of the repository page.
+
+2. **Clone the repository.**
+ You can clone the repository by running the following command in your terminal:
+
+ .. code-block:: bash
+
+ git clone your_forked_repository_url
+
+3. **Sync your fork.**
+ Also, make sure your repository is in sync with the original owner's repository. You can do this by running the following commands:
+
+ .. code-block:: bash
+
+ git remote -v
+
+ You will not see our repo in the list. You can add it by running the following command:
+
+ .. code-block:: bash
+
+ git remote add upstream https://github.com/SylphAI-Inc/AdalFlow.git
+
+ Now, when you run `git remote -v`, you will see the upstream repo.
+ Then, we can sync your fork with the upstream repo by running the following commands:
+
+ .. code-block:: bash
+
+ git fetch upstream
+ git checkout main
+ git merge upstream/main
+
+ *Note: `fetch` will fetch the changes from the upstream repo, but it will not merge them into your local branch. `merge` will merge the changes from the upstream repo into your local branch.*
+ For more detials, please refer to the `Github official syncing a fork guide `_.
+
+4. **Create a new branch.**
+ Create a new branch to ensure your changes are isolated from the main codebase. You can do this by running the following command:
+
+ .. code-block:: bash
+
+ git checkout -b _
+
+ Similarly, you always use step 3 to sync your branch with the upstream repo.
+ Additionally, you can use the following commands to sync:
+
+ .. code-block:: bash
+
+ git fetch --all --prune
+ git rebase upstream/main
+ # follow git instructions to resolve conflicts
+ git push origin your_branch_name
+
+
+Work on your PR
+~~~~~~~~~~~~~~~~~~~~
+
+1. **Set up the pre-commit hooks.**
+ We have a `.pre-commit-config.yaml` file in the root directory.
+ Ensure you have set up the pre-commit hooks. We recommend you to do so in the `poetry` environment.
+ The following steps will help you set up the root poetry environment and the pre-commit hooks:
+ Install `poetry` if you haven't already:
+
+ .. code-block:: bash
+
+ pip install poetry
+
+ You can install the dependencies by running the following command:
+
+ .. code-block:: bash
+
+ poetry install
+
+ Then you can activate the environment by running the following command:
+
+ .. code-block:: bash
+
+ poetry shell
+
+ Then, install the pre-commit hooks by running the following command:
+
+ .. code-block:: bash
+
+ pre-commit install
+
+ *Now, you can start to commit your changes from the `/adalflow` directory next time even if you are not in the poetry environment.*
+ If you have more questions, you can refer to the `pre-commit official guide `_.
+
+2. **Commit your changes.**
+ Once you have made your changes, you can commit them by running the following commands:
+
+ .. code-block:: bash
+
+ git add .
+ git commit -m "Your commit message"
+ git push origin your_branch_name
+
+ If you face "permission denied" issue, you can refer to this `medium blog `_ for help.
+
+3. **Create a Pull Request.**
+ Go to your forked repository on Github and click the `New Pull Request` button. Make sure you select the correct branch for the base and compare branches.
+ Here we have a default `PR template `_ for you to fill in.
+
+4. **Fill in the PR template.**
+ Make sure you fill in the PR template with the necessary information. This will help the reviewers understand your changes better.
+
+5. **Submit the PR**
+ We encourage you to submit the PR as soon as possible, even if it is not ready for review. You can mark it as a draft by:
+ 1. Clicking the `Draft` button on the PR page.
+ 2. Adding `[WIP]` to the PR title.
+
+ .. figure:: ../_static/images/pr_draft.png
+ :alt: Create a draft PR
+ :align: center
+ :width: 700px
+
+ Create a draft PR
+
+6. **Iterate your PR.**
+ Once you have submitted the PR, the reviewers will review your changes and provide feedback. You can iterate your PR by making the necessary changes and pushing them to your branch. The reviewers will review your changes again.
+
+7. **Merge your PR.**
+ Once your PR is approved, the reviewers will merge your PR for you. You can also merge your PR by clicking the `Merge` button on the PR page.
+
+
+
+Part 5: Review Process
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-**WIP PR:** If you are working on an in pull request that is not ready for review, you can create a PR with **"[WIP]"** to inform us that this PR is a draft **βwork in progressβ**.
+For now, we will use the `PyTorch lightning's review guideline `_.
+
+.. Environment
+.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. When contributing, please note:
+.. LightRAG separates the source code environment and documentation environment.
+
+.. * To activate the code environment, you should run ``poetry install`` and ``poetry shell`` under ``./lightrag``. The ``./lightrag/pyproject.toml`` contains the dependencies for the ``LightRAG`` package.
+
+.. * To activate the documentation environment, you can run ``poetry install`` and ``poetry shell`` under ``.``. The ``./pyproject.toml`` controls documentation dependencies.
-**Finished PR:** You can name your finished PR as **"[New Retriever Integration]"** for example.
-We will carry out code review regularly and provide feedbacks as soon as possible.
-Please iterate your PR with the feedbacks. We will try our best to reduce the revision workload on your side.
-Once your PR is approved, we will merge the PR for you.
-If you have any concerns about our feedbacks, please feel free to contact us on `Discord `_.
-Writing Documentation
-----------------------------
-It is a good practice to submit your code with documentations to help the ``LightRAG`` team and other developers better understand your updates.
-Please see our `documentation contribution guidelines <./contribute_to_document.html>`_ for more details on ``LightRAG`` documentation standard.
-.. admonition:: Resources
- :class: highlight
+.. .. admonition:: Resources
+.. :class: highlight
diff --git a/docs/source/contributor/index.rst b/docs/source/contributor/index.rst
index efd71355c..7e2c2da0b 100644
--- a/docs/source/contributor/index.rst
+++ b/docs/source/contributor/index.rst
@@ -1,27 +1,34 @@
-Contributing
+Contributor Guide
=============================
-Welcome to the AdalFlow community! We're building the most user-friendly, modular library for building and auto-optimizing LLM applications, from Chatbots, RAGs, to Agents.
-Think of AdalFlow to LLM applications and in-context learning is like PyTorch/TensorFlow/JAX for AI modeling.
-The goal is to provide basic and foudamental building blocks to build advanced applications with auto-optimization out-of-the-box.
-As we mature, we might see more RAG, memory-based chatbots, or agents frameworks will be built on top of AdalFlow building blocks such as retriever, generator.
+Welcome to the AdalFlow community! We're building the most user-friendly, modular, and powerful library for building and auto-optimizing LLM applications, from Chatbots and RAGs to Agents.
+*Think of AdalFlow for LLM applications and prompt engineering as the PyTorch/TensorFlow/JAX equivalent for AI modeling.*
-We highly suggest you to read our :ref:`design principle` before you start contributing.
+The goal of the library is to provide basic and fundamental building blocks to create advanced applications with auto-optimization out of the box.
+As we mature, we anticipate that more RAG, memory-based chatbots, or agent frameworks will be built on top of AdalFlowβs building blocks, such as `retriever` and `generator`.
+We highly suggest you read our :ref:`design principle` before you start contributing.
-We only accept high quality contribution.
-We appreciate contributors but we have to hold our libary responsible for users.
-Once you decide to contribute, we hope you are not just to list your name on the repo, but more importantly, you learn and improve your own skills! you support your faviroty projects and community!
+We greatly appreciate all contributions, from bug fixes to new features, and value every contributor.
+However, we must be selective to ensure our library remains reliable for users.
+We hope your contributions go beyond listing your name on the repoβour goal is for you to learn, grow your skills, support your favorite projects, and give back to the community!
-It took us 3 months to setup a contributing guide, as we did explore with users and think a lot on how to organize labels and what is the best process that can control the quality of our library while leveraing the open-source community. **We will continously improve our process and we welcome any suggestion and advice.**
-We are determined to make AdalFlow as great and legendary as PyTorch.
+The goal of this guide is to design the best process for maintaining the quality of our library while enabling the community to make meaningful contributions.
+It took us three months to set up this contributor guide, as we first tested the process with early contributors.
+*We are determined to make AdalFlow as great and legendary as PyTorch.*
-The contributing guide includes three parts:
+This guide covers the overall contributing process, along with development essentials for environment setup, coding, testing, and documentation.
+
+Hereβs to the future of LLM applications!
+
+By `Li Yin `_.
+
+.. TODO: add a relation to the whole ecosystem
.. toctree::
+ :caption: Contributor Guide
:maxdepth: 1
contribution
contribute_to_code
- contribute_to_document
.. version_control
diff --git a/docs/source/contributor/version_control.rst b/docs/source/contributor/version_control.rst
index 456c7528b..30c2480ec 100644
--- a/docs/source/contributor/version_control.rst
+++ b/docs/source/contributor/version_control.rst
@@ -7,7 +7,7 @@ Overview
--------
**The version will mainly be managed by the LightRAG team. But we are glad to share how we will release the latest version here.**
-This guide outlines the process for releasing a new version of ``LightRAG``.
+This guide outlines the process for releasing a new version of ``LightRAG``.
The workflow pipeline validates the version tag, builds the package, runs tests, publishes to PyPI, and creates a release on GitHub. The workflow is triggered by tags pushed to the **Release** branch. See `GitHub tags `_ for more details on version release tagging.
Steps to Release a New Version
@@ -18,7 +18,7 @@ Steps to Release a New Version
[tool.poetry]
name = "lightrag"
-
+
version = "0.0.0-rc.1"
description = "The 'PyTorch' library for LLM applications. RAG=Retriever-Agent-Generator."
@@ -49,7 +49,7 @@ Steps to Release a New Version
git add lightrag/pyproject.toml
git commit -m "new version release"
git push origin release
-
+
Since the workflow only processes **tags**, your file submission will not go through the version release workflow.
Only the tags you pushed will get checked.
@@ -66,7 +66,7 @@ Steps to Release a New Version
.. code-block:: python
git tags # list the existing tags
-
+
git tag -d
git push origin --delete
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 18d762c3b..5f2653570 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -318,14 +318,6 @@ We are building a library that unites the two worlds, forming a healthy LLM appl
use_cases/index
-.. toctree::
- :glob:
- :maxdepth: 1
- :hidden:
-
- apis/index
-
-
.. :caption: Benchmarks
.. Manually add documents for the code in benchmarks
@@ -346,3 +338,12 @@ We are building a library that unites the two worlds, forming a healthy LLM appl
:hidden:
contributor/index
+
+
+
+.. toctree::
+ :glob:
+ :maxdepth: 1
+ :hidden:
+
+ apis/index
diff --git a/docs/source/integrations/index.rst b/docs/source/integrations/index.rst
new file mode 100644
index 000000000..313c2f1e2
--- /dev/null
+++ b/docs/source/integrations/index.rst
@@ -0,0 +1 @@
+The integration will be listing all existing integrations and integrations we plan to add.
diff --git a/docs/source/resources/resources.rst b/docs/source/resources/resources.rst
index 08f77d359..4affa68eb 100644
--- a/docs/source/resources/resources.rst
+++ b/docs/source/resources/resources.rst
@@ -3,7 +3,3 @@ Resources
Please check the GitHub for more information:
`GitHub repository `_
-
-
-
-
diff --git a/docs/source/tutorials/base_data_class.rst b/docs/source/tutorials/base_data_class.rst
index f1f1b2437..578782f26 100644
--- a/docs/source/tutorials/base_data_class.rst
+++ b/docs/source/tutorials/base_data_class.rst
@@ -7,7 +7,10 @@
-
+
+
+ Open Source Code
+
DataClass
diff --git a/docs/source/tutorials/component.rst b/docs/source/tutorials/component.rst
index a9e4ae377..649f5310d 100644
--- a/docs/source/tutorials/component.rst
+++ b/docs/source/tutorials/component.rst
@@ -1,7 +1,7 @@
.. raw:: html
-
+
diff --git a/docs/source/tutorials/text_splitter.rst b/docs/source/tutorials/text_splitter.rst
index 60541dff0..4e7da43a8 100644
--- a/docs/source/tutorials/text_splitter.rst
+++ b/docs/source/tutorials/text_splitter.rst
@@ -1,3 +1,15 @@
+.. raw:: html
+
+
+
.. _tutorials-text_splitter:
diff --git a/notebooks/README.md b/notebooks/README.md
index 2e1d4f1cc..3d2e6e94f 100644
--- a/notebooks/README.md
+++ b/notebooks/README.md
@@ -19,6 +19,11 @@ The template consists of three parts:
2. Content section of your notebook. Link to Next that users can look at.
3. Issues and Feedback.
+## If you want to use a ikernel in .ipynb to test notebooks
+
+You can use the following command to install the kernel at the root of the project:
+
+```poetry run python -m ipykernel install --user --name my-project-kernel```
## If you need to use dev api
diff --git a/notebooks/qas/adalflow_object_count_auto_optimization.ipynb b/notebooks/qas/adalflow_object_count_auto_optimization.ipynb
index 65b8509c1..ac7e3cbf5 100644
--- a/notebooks/qas/adalflow_object_count_auto_optimization.ipynb
+++ b/notebooks/qas/adalflow_object_count_auto_optimization.ipynb
@@ -1,8121 +1,8120 @@
{
- "cells": [
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "VVSOpjzJl_cx"
+ },
+ "source": [
+ "# π€ Welcome to AdalFlow!\n",
+ "## The library to build & auto-optimize any LLM task pipelines\n",
+ "\n",
+ "Thanks for trying us out, we're here to provide you with the best LLM application development experience you can dream of π any questions or concerns you may have, [come talk to us on discord,](https://discord.gg/ezzszrRZvT) we're always here to help!\n",
+ "\n",
+ "\n",
+ "# Quick Links\n",
+ "\n",
+ "Github repo: https://github.com/SylphAI-Inc/AdalFlow\n",
+ "\n",
+ "Full Tutorials: https://adalflow.sylph.ai/index.html#.\n",
+ "\n",
+ "Deep dive on each API: check out the [developer notes](https://adalflow.sylph.ai/tutorials/index.html).\n",
+ "\n",
+ "Common use cases along with the auto-optimization: check out [Use cases](https://adalflow.sylph.ai/use_cases/index.html).\n",
+ "\n",
+ "# Outline\n",
+ "\n",
+ "*Note: As training can consume tokens fast, and the notebook runtime will reset everytime you use, it might be better for you to learn training in your local editor.*\n",
+ "\n",
+ "This is a quick introduction of AdalFlow on question answering use case end to end\n",
+ "\n",
+ "* Trainable Task pipeline with trainable parameters\n",
+ "* Create AdalComponent for your task pipeline\n",
+ "* Use Trainer to diagnose, debug, and to train.\n",
+ "\n",
+ "You can find all source code here: https://github.com/SylphAI-Inc/AdalFlow/tree/main/use_cases/question_answering/bhh_object_count\n",
+ "\n",
+ "**Here is the more detailed tutorial for the code here: https://adalflow.sylph.ai/use_cases/question_answering.html**\n",
+ "\n",
+ "\n",
+ "# Installation\n",
+ "\n",
+ "1. Use `pip` to install the `adalflow` Python package. We will need `openai`, `groq`, and `faiss`(cpu version) from the extra packages.\n",
+ "\n",
+ " ```bash\n",
+ " pip install adalflow[openai,groq,faiss-cpu]\n",
+ " ```\n",
+ "2. Setup `openai` and `groq` API key in the environment variables"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "THTvmhjgfiHE"
+ },
+ "outputs": [],
+ "source": [
+ "from IPython.display import clear_output\n",
+ "\n",
+ "!pip install -U adalflow[openai,groq,datasets]\n",
+ "\n",
+ "clear_output()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 35
+ },
+ "id": "nJteJKsNrpcu",
+ "outputId": "d9f7b4d0-d11c-480d-d858-bf9022c18998"
+ },
+ "outputs": [
{
- "cell_type": "markdown",
- "metadata": {
- "id": "VVSOpjzJl_cx"
+ "data": {
+ "application/vnd.google.colaboratory.intrinsic+json": {
+ "type": "string"
},
- "source": [
- "# π€ Welcome to AdalFlow!\n",
- "## The library to build & auto-optimize any LLM task pipelines\n",
- "\n",
- "Thanks for trying us out, we're here to provide you with the best LLM application development experience you can dream of π any questions or concerns you may have, [come talk to us on discord,](https://discord.gg/ezzszrRZvT) we're always here to help!\n",
- "\n",
- "\n",
- "# Quick Links\n",
- "\n",
- "Github repo: https://github.com/SylphAI-Inc/AdalFlow\n",
- "\n",
- "Full Tutorials: https://adalflow.sylph.ai/index.html#.\n",
- "\n",
- "Deep dive on each API: check out the [developer notes](https://adalflow.sylph.ai/tutorials/index.html).\n",
- "\n",
- "Common use cases along with the auto-optimization: check out [Use cases](https://adalflow.sylph.ai/use_cases/index.html).\n",
- "\n",
- "# Outline\n",
- "\n",
- "*Note: As training can consume tokens fast, and the notebook runtime will reset everytime you use, it might be better for you to learn training in your local editor.*\n",
- "\n",
- "This is a quick introduction of AdalFlow on question answering use case end to end\n",
- "\n",
- "* Trainable Task pipeline with trainable parameters\n",
- "* Create AdalComponent for your task pipeline\n",
- "* Use Trainer to diagnose, debug, and to train.\n",
- "\n",
- "You can find all source code here: https://github.com/SylphAI-Inc/AdalFlow/tree/main/use_cases/question_answering/bhh_object_count\n",
- "\n",
- "**Here is the more detailed tutorial for the code here: https://adalflow.sylph.ai/use_cases/question_answering.html**\n",
- "\n",
- "\n",
- "# Installation\n",
- "\n",
- "1. Use `pip` to install the `adalflow` Python package. We will need `openai`, `groq`, and `faiss`(cpu version) from the extra packages.\n",
- "\n",
- " ```bash\n",
- " pip install adalflow[openai,groq,faiss-cpu]\n",
- " ```\n",
- "2. Setup `openai` and `groq` API key in the environment variables"
+ "text/plain": [
+ "'0.2.0'"
]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import adalflow as adal\n",
+ "\n",
+ "adal.__version__"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "KapUyHMM07pJ"
+ },
+ "source": [
+ "## Set Environment Variables\n",
+ "\n",
+ "Run the following code and pass your api key.\n",
+ "\n",
+ "Note: for normal `.py` projects, follow our [official installation guide](https://lightrag.sylph.ai/get_started/installation.html).\n",
+ "\n",
+ "*Go to [OpenAI](https://platform.openai.com/docs/introduction) and [Groq](https://console.groq.com/docs/) to get API keys if you don't already have.*"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "ONfzF9Puzdd_",
+ "outputId": "6a815e21-ab99-463e-c53b-e39ca2ce8f3f"
+ },
+ "outputs": [
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "THTvmhjgfiHE"
- },
- "outputs": [],
- "source": [
- "from IPython.display import clear_output\n",
- "\n",
- "!pip install -U adalflow[openai,groq,datasets]\n",
- "\n",
- "clear_output()"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Please enter your OpenAI API key: Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·\n",
+ "Please enter your GROQ API key: Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·\n",
+ "API keys have been set.\n"
+ ]
+ }
+ ],
+ "source": [
+ "import os\n",
+ "\n",
+ "from getpass import getpass\n",
+ "\n",
+ "# Prompt user to enter their API keys securely\n",
+ "openai_api_key = getpass(\"Please enter your OpenAI API key: \")\n",
+ "groq_api_key = getpass(\"Please enter your GROQ API key, simplly press Enter if you don't have one: \")\n",
+ "\n",
+ "\n",
+ "# Set environment variables\n",
+ "os.environ['OPENAI_API_KEY'] = openai_api_key\n",
+ "os.environ['GROQ_API_KEY'] = groq_api_key\n",
+ "\n",
+ "print(\"API keys have been set.\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "SfGS7iddtfpj"
+ },
+ "source": [
+ "\n",
+ "\n",
+ "# π Trainable Task Pipeline\n",
+ "\n",
+ "We will create a task pipeline consists of a generator, with a customzied template, a customized output parser.\n",
+ "\n",
+ "Different from our other pipelines where the `prompt_kwargs` values are strings, but here we will use ``Parameter``. And we will set up two parameter, one is of ``ParameterType.PROMPT`` and the other of type ``ParameterType.DEMOS``. The first one will be trained by text-grad and the second will be trained by boostrap few shot optimizer.\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "nHnvAbO-pXUq"
+ },
+ "outputs": [],
+ "source": [
+ "import adalflow as adal\n",
+ "import re\n",
+ "from typing import Dict, Union\n",
+ "import adalflow as adal\n",
+ "from adalflow.optim.types import ParameterType\n",
+ "\n",
+ "\n",
+ "@adal.fun_to_component\n",
+ "def parse_integer_answer(answer: str):\n",
+ " \"\"\"A function that parses the last integer from a string using regular expressions.\"\"\"\n",
+ " try:\n",
+ " # Use regular expression to find all sequences of digits\n",
+ " numbers = re.findall(r\"\\d+\", answer)\n",
+ " if numbers:\n",
+ " # Get the last number found\n",
+ " answer = int(numbers[-1])\n",
+ " else:\n",
+ " answer = -1\n",
+ " except ValueError:\n",
+ " answer = -1\n",
+ "\n",
+ " return answer\n",
+ "\n",
+ "\n",
+ "few_shot_template = r\"\"\"\n",
+ "{{system_prompt}}\n",
+ "{# Few shot demos #}\n",
+ "{% if few_shot_demos is not none %}\n",
+ "Here are some examples:\n",
+ "{{few_shot_demos}}\n",
+ "{% endif %}\n",
+ "\n",
+ "\n",
+ "{{input_str}}\n",
+ "\n",
+ "\"\"\"\n",
+ "\n",
+ "class ObjectCountTaskPipeline(adal.Component):\n",
+ " def __init__(self, model_client: adal.ModelClient, model_kwargs: Dict):\n",
+ " super().__init__()\n",
+ "\n",
+ " system_prompt = adal.Parameter(\n",
+ " data=\"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\",\n",
+ " role_desc=\"To give task instruction to the language model in the system prompt\",\n",
+ " requires_opt=True,\n",
+ " param_type=ParameterType.PROMPT,\n",
+ " )\n",
+ " few_shot_demos = adal.Parameter(\n",
+ " data=None,\n",
+ " role_desc=\"To provide few shot demos to the language model\",\n",
+ " requires_opt=True, # Changed to True for few-shot learning\n",
+ " param_type=ParameterType.DEMOS,\n",
+ " )\n",
+ "\n",
+ " self.llm_counter = adal.Generator(\n",
+ " model_client=model_client,\n",
+ " model_kwargs=model_kwargs,\n",
+ " template=few_shot_template,\n",
+ " prompt_kwargs={\n",
+ " \"system_prompt\": system_prompt,\n",
+ " \"few_shot_demos\": few_shot_demos,\n",
+ " },\n",
+ " output_processors=parse_integer_answer,\n",
+ " use_cache=True,\n",
+ " )\n",
+ "\n",
+ " def call(\n",
+ " self, question: str, id: str = None\n",
+ " ) -> Union[adal.GeneratorOutput, adal.Parameter]:\n",
+ " output = self.llm_counter(prompt_kwargs={\"input_str\": question}, id=id)\n",
+ " return output\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "AvZJjdzZa0cT"
+ },
+ "source": [
+ "Next, we will run this pipeline in both train and eval mode.\n",
+ "\n",
+ "#### Eval mode with GeneratorOutput\n",
+ "\n",
+ "Eval mode will output ``GeneratorOutput``.\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "Gks3yS8hcR6_"
+ },
+ "source": [
+ "\n",
+ "#### Train mode with different form of output\n",
+ "\n",
+ "Train mode will return ``Parameter``, where the `data` field will be the `raw_response`` from the GeneratorOutput, and we put the full GeneratorOutput at the ``full_response`` in the parameter.\n",
+ "\n",
+ "As the `data` field of the `Parameter` directly communicate with the Optimizer, which are an LLM itself, its better than they understand exactly the string response itself instead of the parsed one.\n",
+ "\n",
+ "Later you will see that we also use ``eval_input`` of the parameter to communicate with the `LossFunction` as that need the parsed final output."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "eqQSFnZOpfWJ",
+ "outputId": "05b5fc83-09d1-45f4-aacc-6d460fbdd7bd"
+ },
+ "outputs": [
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 35
- },
- "id": "nJteJKsNrpcu",
- "outputId": "d9f7b4d0-d11c-480d-d858-bf9022c18998"
- },
- "outputs": [
- {
- "data": {
- "application/vnd.google.colaboratory.intrinsic+json": {
- "type": "string"
- },
- "text/plain": [
- "'0.2.0'"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "import adalflow as adal\n",
- "\n",
- "adal.__version__"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "KapUyHMM07pJ"
- },
- "source": [
- "## Set Environment Variables\n",
- "\n",
- "Run the following code and pass your api key.\n",
- "\n",
- "Note: for normal `.py` projects, follow our [official installation guide](https://lightrag.sylph.ai/get_started/installation.html).\n",
- "\n",
- "*Go to [OpenAI](https://platform.openai.com/docs/introduction) and [Groq](https://console.groq.com/docs/) to get API keys if you don't already have.*"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
+ "ObjectCountTaskPipeline(\n",
+ " (llm_counter): Generator(\n",
+ " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ " )\n",
+ ")\n"
+ ]
+ }
+ ],
+ "source": [
+ "from adalflow.components.model_client.openai_client import OpenAIClient\n",
+ "from adalflow.components.model_client.groq_client import GroqAPIClient\n",
+ "\n",
+ "\n",
+ "if len(os.environ['OPENAI_API_KEY']) > 1:\n",
+ " gpt_3_model = {\n",
+ " \"model_client\": OpenAIClient(),\n",
+ " \"model_kwargs\": {\n",
+ " \"model\": \"gpt-3.5-turbo\",\n",
+ " \"max_tokens\": 2000,\n",
+ " \"temperature\": 0.0,\n",
+ " \"top_p\": 0.99,\n",
+ " \"frequency_penalty\": 0,\n",
+ " \"presence_penalty\": 0,\n",
+ " \"stop\": None,\n",
+ " },\n",
+ " }\n",
+ " gpt_4o_model = {\n",
+ " \"model_client\": OpenAIClient(),\n",
+ " \"model_kwargs\": {\n",
+ " \"model\": \"gpt-4o\",\n",
+ " \"max_tokens\": 4000,\n",
+ " \"temperature\": 0.0,\n",
+ " \"top_p\": 0.99,\n",
+ " \"frequency_penalty\": 0,\n",
+ " \"presence_penalty\": 0,\n",
+ " \"stop\": None,\n",
+ " },\n",
+ " }\n",
+ "\n",
+ "if len(os.environ['GROQ_API_KEY']) > 1:\n",
+ " llama_3_1_model ={\n",
+ " \"model_client\": GroqAPIClient(),\n",
+ " \"model_kwargs\": {\n",
+ " \"model\": \"llama-3.1-8b-instant\"\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ "question = \"I have a flute, a piano, a trombone, four stoves, a violin, an accordion, a clarinet, a drum, two lamps, and a trumpet. How many musical instruments do I have?\"\n",
+ "task_pipeline = ObjectCountTaskPipeline(**gpt_3_model)\n",
+ "print(task_pipeline)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "DE1xNdYvcXw8",
+ "outputId": "25844c2a-5d4c-4c68-8ca5-38b79ca5b398"
+ },
+ "outputs": [
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "ONfzF9Puzdd_",
- "outputId": "6a815e21-ab99-463e-c53b-e39ca2ce8f3f"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Please enter your OpenAI API key: Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·\n",
- "Please enter your GROQ API key: Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·\n",
- "API keys have been set.\n"
- ]
- }
- ],
- "source": [
- "import os\n",
- "\n",
- "from getpass import getpass\n",
- "\n",
- "# Prompt user to enter their API keys securely\n",
- "openai_api_key = getpass(\"Please enter your OpenAI API key: \")\n",
- "groq_api_key = getpass(\"Please enter your GROQ API key, simplly press Enter if you don't have one: \")\n",
- "\n",
- "\n",
- "# Set environment variables\n",
- "os.environ['OPENAI_API_KEY'] = openai_api_key\n",
- "os.environ['GROQ_API_KEY'] = groq_api_key\n",
- "\n",
- "print(\"API keys have been set.\")"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "GeneratorOutput(id='1', data=8, error=None, usage=CompletionUsage(completion_tokens=77, prompt_tokens=113, total_tokens=190), raw_response='To find the total number of musical instruments you have, you simply need to count the individual instruments you listed. \\n\\nYou have:\\n- Flute\\n- Piano\\n- Trombone\\n- Violin\\n- Accordion\\n- Clarinet\\n- Drum\\n- Trumpet\\n\\nCounting each of these instruments, we get a total of 8 musical instruments.\\n\\nAnswer: 8', metadata=None)\n"
+ ]
+ }
+ ],
+ "source": [
+ "answer = task_pipeline(question, id=\"1\")\n",
+ "print(answer)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "AGUlUsGxcaby",
+ "outputId": "8c8588fe-2994-4d9e-c2d1-26453141f43f"
+ },
+ "outputs": [
{
- "cell_type": "markdown",
- "metadata": {
- "id": "SfGS7iddtfpj"
- },
- "source": [
- "\n",
- "\n",
- "# π Trainable Task Pipeline\n",
- "\n",
- "We will create a task pipeline consists of a generator, with a customzied template, a customized output parser.\n",
- "\n",
- "Different from our other pipelines where the `prompt_kwargs` values are strings, but here we will use ``Parameter``. And we will set up two parameter, one is of ``ParameterType.PROMPT`` and the other of type ``ParameterType.DEMOS``. The first one will be trained by text-grad and the second will be trained by boostrap few shot optimizer.\n",
- "\n",
- "\n"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parameter(name=Generator_output, requires_opt=True, param_type=generator_output (The output of the generator.), role_desc=Output from (llm) Generator, data=To find the total number of musical instruments you have, you simply need to count the individual instruments you listed. \n",
+ "\n",
+ "You have:\n",
+ "- Flute\n",
+ "- Piano\n",
+ "- Trombone\n",
+ "- Violin\n",
+ "- Accordion\n",
+ "- Clarinet\n",
+ "- Drum\n",
+ "- Trumpet\n",
+ "\n",
+ "Counting each of these instruments, we get a total of 8 musical instruments.\n",
+ "\n",
+ "Answer: 8, predecessors={Parameter(name=To_provide, requires_opt=True, param_type=demos (A few examples to guide the language model.), role_desc=To provide few shot demos to the language model, data=None, predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={}), Parameter(name=To_give_ta, requires_opt=True, param_type=prompt (Instruction to the language model on task, data, and format.), role_desc=To give task instruction to the language model in the system prompt, data=You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value., predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={})}, gradients=[], raw_response=None, input_args={'prompt_kwargs': {'system_prompt': Parameter(name=To_give_ta, requires_opt=True, param_type=prompt (Instruction to the language model on task, data, and format.), role_desc=To give task instruction to the language model in the system prompt, data=You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value., predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={}), 'few_shot_demos': Parameter(name=To_provide, requires_opt=True, param_type=demos (A few examples to guide the language model.), role_desc=To provide few shot demos to the language model, data=None, predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={}), 'input_str': 'I have a flute, a piano, a trombone, four stoves, a violin, an accordion, a clarinet, a drum, two lamps, and a trumpet. How many musical instruments do I have?'}, 'model_kwargs': {'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, traces={})\n",
+ "full_response: GeneratorOutput(id=None, data=8, error=None, usage=CompletionUsage(completion_tokens=77, prompt_tokens=113, total_tokens=190), raw_response='To find the total number of musical instruments you have, you simply need to count the individual instruments you listed. \\n\\nYou have:\\n- Flute\\n- Piano\\n- Trombone\\n- Violin\\n- Accordion\\n- Clarinet\\n- Drum\\n- Trumpet\\n\\nCounting each of these instruments, we get a total of 8 musical instruments.\\n\\nAnswer: 8', metadata=None)\n"
+ ]
+ }
+ ],
+ "source": [
+ "# set it to train mode\n",
+ "task_pipeline.train()\n",
+ "answer = task_pipeline(question, id=\"1\")\n",
+ "print(answer)\n",
+ "print(f\"full_response: {answer.full_response}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "YDAiuFzcr4YA"
+ },
+ "outputs": [],
+ "source": [
+ "!pip install datasets\n",
+ "clear_output()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "-Gvfcy2IcgWx"
+ },
+ "source": [
+ "### Load Datasets"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "AYBIGsIHpjMe"
+ },
+ "outputs": [],
+ "source": [
+ "from adalflow.datasets.big_bench_hard import BigBenchHard\n",
+ "from adalflow.utils.data import subset_dataset\n",
+ "\n",
+ "def load_datasets(max_samples: int = None):\n",
+ " \"\"\"Load the dataset\"\"\"\n",
+ " train_data = BigBenchHard(split=\"train\")\n",
+ " val_data = BigBenchHard(split=\"val\")\n",
+ " test_data = BigBenchHard(split=\"test\")\n",
+ "\n",
+ " # Limit the number of samples\n",
+ " if max_samples:\n",
+ " train_data = subset_dataset(train_data, max_samples)\n",
+ " val_data = subset_dataset(val_data, max_samples)\n",
+ " test_data = subset_dataset(test_data, max_samples)\n",
+ "\n",
+ " return train_data, val_data, test_data\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "asw-pJrid8ly",
+ "outputId": "31807c34-0de9-45e5-ebdd-778aa5313802"
+ },
+ "outputs": [
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "nHnvAbO-pXUq"
- },
- "outputs": [],
- "source": [
- "import adalflow as adal\n",
- "import re\n",
- "from typing import Dict, Union\n",
- "import adalflow as adal\n",
- "from adalflow.optim.types import ParameterType\n",
- "\n",
- "\n",
- "@adal.fun_to_component\n",
- "def parse_integer_answer(answer: str):\n",
- " \"\"\"A function that parses the last integer from a string using regular expressions.\"\"\"\n",
- " try:\n",
- " # Use regular expression to find all sequences of digits\n",
- " numbers = re.findall(r\"\\d+\", answer)\n",
- " if numbers:\n",
- " # Get the last number found\n",
- " answer = int(numbers[-1])\n",
- " else:\n",
- " answer = -1\n",
- " except ValueError:\n",
- " answer = -1\n",
- "\n",
- " return answer\n",
- "\n",
- "\n",
- "few_shot_template = r\"\"\"\n",
- "{{system_prompt}}\n",
- "{# Few shot demos #}\n",
- "{% if few_shot_demos is not none %}\n",
- "Here are some examples:\n",
- "{{few_shot_demos}}\n",
- "{% endif %}\n",
- "\n",
- "\n",
- "{{input_str}}\n",
- "\n",
- "\"\"\"\n",
- "\n",
- "class ObjectCountTaskPipeline(adal.Component):\n",
- " def __init__(self, model_client: adal.ModelClient, model_kwargs: Dict):\n",
- " super().__init__()\n",
- "\n",
- " system_prompt = adal.Parameter(\n",
- " data=\"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\",\n",
- " role_desc=\"To give task instruction to the language model in the system prompt\",\n",
- " requires_opt=True,\n",
- " param_type=ParameterType.PROMPT,\n",
- " )\n",
- " few_shot_demos = adal.Parameter(\n",
- " data=None,\n",
- " role_desc=\"To provide few shot demos to the language model\",\n",
- " requires_opt=True, # Changed to True for few-shot learning\n",
- " param_type=ParameterType.DEMOS,\n",
- " )\n",
- "\n",
- " self.llm_counter = adal.Generator(\n",
- " model_client=model_client,\n",
- " model_kwargs=model_kwargs,\n",
- " template=few_shot_template,\n",
- " prompt_kwargs={\n",
- " \"system_prompt\": system_prompt,\n",
- " \"few_shot_demos\": few_shot_demos,\n",
- " },\n",
- " output_processors=parse_integer_answer,\n",
- " use_cache=True,\n",
- " )\n",
- "\n",
- " def call(\n",
- " self, question: str, id: str = None\n",
- " ) -> Union[adal.GeneratorOutput, adal.Parameter]:\n",
- " output = self.llm_counter(prompt_kwargs={\"input_str\": question}, id=id)\n",
- " return output\n",
- "\n",
- "\n"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example(id='d3f33ded-170a-4b87-9b0b-987d5fb7b817', question='I have a cauliflower, a stalk of celery, a cabbage, and a garlic. How many vegetables do I have?', answer='4')\n"
+ ]
+ }
+ ],
+ "source": [
+ "# check the datasets\n",
+ "\n",
+ "train_data, val_data, test_data = load_datasets(max_samples=2)\n",
+ "print(train_data[0])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "VAVtXE9xeEHt"
+ },
+ "source": [
+ "### Soft link to AdalFlow default file path\n",
+ "\n",
+ "Lets' match the default to the current project, so that you can see the downloaded data and later the checkpoints of the training."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "1SaKH6dkeWus"
+ },
+ "outputs": [],
+ "source": [
+ "! ln -s /root/.adalflow /content/adalflow\n",
+ "\n",
+ "# go to files then you will see a folder named as adalflow"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "YWZzOvAHenME"
+ },
+ "source": [
+ "# π AdalComponent to define everything we need to train\n",
+ "\n",
+ "1. We need `backward_engine_model_config`` for ``backward_engine`` to compute gradient.\n",
+ "\n",
+ "2. We need ``text_optimizer_model_config`` for the `text optimizer` for propose new prompts.\n",
+ "\n",
+ "3. For the demo optimizer, we need a `teacher_model_config` to config a teacher generator, in this case, it is the `llm_counter`. The teacher will share the same prompt with the `llm_counter` but you can use a more advanced model.\n",
+ "\n",
+ "In general, we should have all of these parts to use a more advanced model."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "9QoNoMWD0rgV"
+ },
+ "source": [
+ "## π§ Diagnose\n",
+ "\n",
+ "Diagnose is more of an evaluation, but with detailed logs so that you can manually inspect the wrong output.\n",
+ "\n",
+ "This one shows the minimum config you need to get the `diagnose` work."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "6mi7lM3U24Eg"
+ },
+ "outputs": [],
+ "source": [
+ "from adalflow.datasets.types import Example\n",
+ "from adalflow.eval.answer_match_acc import AnswerMatchAcc\n",
+ "\n",
+ "\n",
+ "class ObjectCountAdalComponent(adal.AdalComponent):\n",
+ " def __init__(self, model_client: adal.ModelClient, model_kwargs: Dict):\n",
+ " task = ObjectCountTaskPipeline(model_client, model_kwargs)\n",
+ " eval_fn = AnswerMatchAcc(type=\"exact_match\").compute_single_item\n",
+ " super().__init__(task=task, eval_fn=eval_fn)\n",
+ "\n",
+ " def prepare_task(self, sample: Example):\n",
+ " return self.task.call, {\"question\": sample.question, \"id\": sample.id}\n",
+ "\n",
+ " def prepare_eval(\n",
+ " self, sample: Example, y_pred: adal.GeneratorOutput\n",
+ " ) -> float:\n",
+ " y_label = -1\n",
+ " if (y_pred is not None and y_pred.data is not None): # if y_pred and y_pred.data: might introduce bug when the data is 0\n",
+ " y_label = y_pred.data\n",
+ " return self.eval_fn, {\"y\": y_label, \"y_gt\": sample.answer}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "eliPeVeM2wcP"
+ },
+ "outputs": [],
+ "source": [
+ "def diagnose(\n",
+ " model_client: adal.ModelClient,\n",
+ " model_kwargs: Dict,\n",
+ ") -> Dict:\n",
+ "\n",
+ " trainset, valset, testset = load_datasets()\n",
+ " # use max_samples=10 to test the code\n",
+ "\n",
+ " adal_component = ObjectCountAdalComponent(model_client, model_kwargs)\n",
+ " trainer = adal.Trainer(adaltask=adal_component)\n",
+ " trainer.diagnose(dataset=trainset, split=\"train\")\n",
+ " trainer.diagnose(dataset=valset, split=\"val\")\n",
+ " trainer.diagnose(dataset=testset, split=\"test\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "nKl9clcb3dFj",
+ "outputId": "676fbb96-c70b-40ab-ea15-93ade1aa9e66"
+ },
+ "outputs": [
{
- "cell_type": "markdown",
- "metadata": {
- "id": "AvZJjdzZa0cT"
- },
- "source": [
- "Next, we will run this pipeline in both train and eval mode.\n",
- "\n",
- "#### Eval mode with GeneratorOutput\n",
- "\n",
- "Eval mode will output ``GeneratorOutput``.\n",
- "\n"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "Gks3yS8hcR6_"
- },
- "source": [
- "\n",
- "#### Train mode with different form of output\n",
- "\n",
- "Train mode will return ``Parameter``, where the `data` field will be the `raw_response`` from the GeneratorOutput, and we put the full GeneratorOutput at the ``full_response`` in the parameter.\n",
- "\n",
- "As the `data` field of the `Parameter` directly communicate with the Optimizer, which are an LLM itself, its better than they understand exactly the string response itself instead of the parsed one.\n",
- "\n",
- "Later you will see that we also use ``eval_input`` of the parameter to communicate with the `LossFunction` as that need the parsed final output."
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
+ "Checkpoint path: /root/.adalflow/ckpt/ObjectCountAdalComponent\n",
+ "Save diagnose to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_train\n",
+ "Saving traces to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_train\n",
+ "all_generators: [('llm_counter', Generator(\n",
+ " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ "))]\n",
+ "Registered callback for llm_counter, file path: /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_train/llm_counter_call.jsonl\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "eqQSFnZOpfWJ",
- "outputId": "05b5fc83-09d1-45f4-aacc-6d460fbdd7bd"
- },
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
- "ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- ")\n"
- ]
- }
- ],
- "source": [
- "from adalflow.components.model_client.openai_client import OpenAIClient\n",
- "from adalflow.components.model_client.groq_client import GroqAPIClient\n",
- "\n",
- "\n",
- "if len(os.environ['OPENAI_API_KEY']) > 1:\n",
- " gpt_3_model = {\n",
- " \"model_client\": OpenAIClient(),\n",
- " \"model_kwargs\": {\n",
- " \"model\": \"gpt-3.5-turbo\",\n",
- " \"max_tokens\": 2000,\n",
- " \"temperature\": 0.0,\n",
- " \"top_p\": 0.99,\n",
- " \"frequency_penalty\": 0,\n",
- " \"presence_penalty\": 0,\n",
- " \"stop\": None,\n",
- " },\n",
- " }\n",
- " gpt_4o_model = {\n",
- " \"model_client\": OpenAIClient(),\n",
- " \"model_kwargs\": {\n",
- " \"model\": \"gpt-4o\",\n",
- " \"max_tokens\": 4000,\n",
- " \"temperature\": 0.0,\n",
- " \"top_p\": 0.99,\n",
- " \"frequency_penalty\": 0,\n",
- " \"presence_penalty\": 0,\n",
- " \"stop\": None,\n",
- " },\n",
- " }\n",
- "\n",
- "if len(os.environ['GROQ_API_KEY']) > 1:\n",
- " llama_3_1_model ={\n",
- " \"model_client\": GroqAPIClient(),\n",
- " \"model_kwargs\": {\n",
- " \"model\": \"llama-3.1-8b-instant\"\n",
- " }\n",
- " }\n",
- "\n",
- "\n",
- "question = \"I have a flute, a piano, a trombone, four stoves, a violin, an accordion, a clarinet, a drum, two lamps, and a trumpet. How many musical instruments do I have?\"\n",
- "task_pipeline = ObjectCountTaskPipeline(**gpt_3_model)\n",
- "print(task_pipeline)\n"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 5957.82it/s]\n",
+ "Evaluating step(0): 0.88 across 50 samples, Max potential: 0.88: 100%|ββββββββββ| 50/50 [00:15<00:00, 3.27it/s]\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "DE1xNdYvcXw8",
- "outputId": "25844c2a-5d4c-4c68-8ca5-38b79ca5b398"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "GeneratorOutput(id='1', data=8, error=None, usage=CompletionUsage(completion_tokens=77, prompt_tokens=113, total_tokens=190), raw_response='To find the total number of musical instruments you have, you simply need to count the individual instruments you listed. \\n\\nYou have:\\n- Flute\\n- Piano\\n- Trombone\\n- Violin\\n- Accordion\\n- Clarinet\\n- Drum\\n- Trumpet\\n\\nCounting each of these instruments, we get a total of 8 musical instruments.\\n\\nAnswer: 8', metadata=None)\n"
- ]
- }
- ],
- "source": [
- "answer = task_pipeline(question, id=\"1\")\n",
- "print(answer)"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "sorted_indices: [8, 16, 23, 25, 31, 47, 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49]\n",
+ "sorted_scores: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]\n",
+ "Loading log file: llm_counter_call.jsonl\n",
+ "Total error samples: 6\n",
+ "Save diagnose to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_val\n",
+ "Saving traces to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_val\n",
+ "all_generators: [('llm_counter', Generator(\n",
+ " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ "))]\n",
+ "Registered callback for llm_counter, file path: /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_val/llm_counter_call.jsonl\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "AGUlUsGxcaby",
- "outputId": "8c8588fe-2994-4d9e-c2d1-26453141f43f"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Parameter(name=Generator_output, requires_opt=True, param_type=generator_output (The output of the generator.), role_desc=Output from (llm) Generator, data=To find the total number of musical instruments you have, you simply need to count the individual instruments you listed. \n",
- "\n",
- "You have:\n",
- "- Flute\n",
- "- Piano\n",
- "- Trombone\n",
- "- Violin\n",
- "- Accordion\n",
- "- Clarinet\n",
- "- Drum\n",
- "- Trumpet\n",
- "\n",
- "Counting each of these instruments, we get a total of 8 musical instruments.\n",
- "\n",
- "Answer: 8, predecessors={Parameter(name=To_provide, requires_opt=True, param_type=demos (A few examples to guide the language model.), role_desc=To provide few shot demos to the language model, data=None, predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={}), Parameter(name=To_give_ta, requires_opt=True, param_type=prompt (Instruction to the language model on task, data, and format.), role_desc=To give task instruction to the language model in the system prompt, data=You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value., predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={})}, gradients=[], raw_response=None, input_args={'prompt_kwargs': {'system_prompt': Parameter(name=To_give_ta, requires_opt=True, param_type=prompt (Instruction to the language model on task, data, and format.), role_desc=To give task instruction to the language model in the system prompt, data=You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value., predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={}), 'few_shot_demos': Parameter(name=To_provide, requires_opt=True, param_type=demos (A few examples to guide the language model.), role_desc=To provide few shot demos to the language model, data=None, predecessors=set(), gradients=[], raw_response=None, input_args=None, traces={}), 'input_str': 'I have a flute, a piano, a trombone, four stoves, a violin, an accordion, a clarinet, a drum, two lamps, and a trumpet. How many musical instruments do I have?'}, 'model_kwargs': {'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, traces={})\n",
- "full_response: GeneratorOutput(id=None, data=8, error=None, usage=CompletionUsage(completion_tokens=77, prompt_tokens=113, total_tokens=190), raw_response='To find the total number of musical instruments you have, you simply need to count the individual instruments you listed. \\n\\nYou have:\\n- Flute\\n- Piano\\n- Trombone\\n- Violin\\n- Accordion\\n- Clarinet\\n- Drum\\n- Trumpet\\n\\nCounting each of these instruments, we get a total of 8 musical instruments.\\n\\nAnswer: 8', metadata=None)\n"
- ]
- }
- ],
- "source": [
- "# set it to train mode\n",
- "task_pipeline.train()\n",
- "answer = task_pipeline(question, id=\"1\")\n",
- "print(answer)\n",
- "print(f\"full_response: {answer.full_response}\")"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3203.76it/s]\n",
+ "Evaluating step(0): 0.8 across 50 samples, Max potential: 0.8: 100%|ββββββββββ| 50/50 [00:15<00:00, 3.26it/s]\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "YDAiuFzcr4YA"
- },
- "outputs": [],
- "source": [
- "!pip install datasets\n",
- "clear_output()"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "sorted_indices: [1, 2, 5, 10, 24, 36, 38, 42, 44, 47, 0, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 39, 40, 41, 43, 45, 46, 48, 49]\n",
+ "sorted_scores: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]\n",
+ "Loading log file: llm_counter_call.jsonl\n",
+ "Total error samples: 10\n",
+ "Save diagnose to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_test\n",
+ "Saving traces to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_test\n",
+ "all_generators: [('llm_counter', Generator(\n",
+ " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ "))]\n",
+ "Registered callback for llm_counter, file path: /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_test/llm_counter_call.jsonl\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "-Gvfcy2IcgWx"
- },
- "source": [
- "### Load Datasets"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Loading Data: 100%|ββββββββββ| 100/100 [00:00<00:00, 5545.09it/s]\n",
+ "Evaluating step(0): 0.83 across 100 samples, Max potential: 0.83: 100%|ββββββββββ| 100/100 [00:28<00:00, 3.50it/s]"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "AYBIGsIHpjMe"
- },
- "outputs": [],
- "source": [
- "from adalflow.datasets.big_bench_hard import BigBenchHard\n",
- "from adalflow.utils.data import subset_dataset\n",
- "\n",
- "def load_datasets(max_samples: int = None):\n",
- " \"\"\"Load the dataset\"\"\"\n",
- " train_data = BigBenchHard(split=\"train\")\n",
- " val_data = BigBenchHard(split=\"val\")\n",
- " test_data = BigBenchHard(split=\"test\")\n",
- "\n",
- " # Limit the number of samples\n",
- " if max_samples:\n",
- " train_data = subset_dataset(train_data, max_samples)\n",
- " val_data = subset_dataset(val_data, max_samples)\n",
- " test_data = subset_dataset(test_data, max_samples)\n",
- "\n",
- " return train_data, val_data, test_data\n"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "sorted_indices: [7, 18, 19, 20, 23, 24, 25, 43, 58, 59, 63, 74, 75, 79, 85, 97, 99, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 21, 22, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98]\n",
+ "sorted_scores: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]\n",
+ "Loading log file: llm_counter_call.jsonl\n",
+ "Total error samples: 17\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "asw-pJrid8ly",
- "outputId": "31807c34-0de9-45e5-ebdd-778aa5313802"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Example(id='d3f33ded-170a-4b87-9b0b-987d5fb7b817', question='I have a cauliflower, a stalk of celery, a cabbage, and a garlic. How many vegetables do I have?', answer='4')\n"
- ]
- }
- ],
- "source": [
- "# check the datasets\n",
- "\n",
- "train_data, val_data, test_data = load_datasets(max_samples=2)\n",
- "print(train_data[0])"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "diagnose(**gpt_3_model)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "dSu4VQri3y3D"
+ },
+ "source": [
+ "Now, you can go to `/content/adalflow/ckpt/ObjectCountAdalComponent/diagnose_train/stats.json` to view the average score for each split. And also the `diagnose.json` for different errors.\n",
+ "\n",
+ "Here is the overall score for each split.\n",
+ "\n",
+ "| Train | Val| Test |\n",
+ "|:--------- |:--------:| ---------:|\n",
+ "| 0.88 | 0.8 | 0.83 |\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "1vzJyp-W0z7I"
+ },
+ "source": [
+ "## π Debug"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "TmlCvJu804dJ"
+ },
+ "source": [
+ "## β
Train\n",
+ "\n",
+ "Now, let's start training."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "4TWCn0did6-K"
+ },
+ "outputs": [],
+ "source": [
+ "from adalflow.datasets.types import Example\n",
+ "\n",
+ "\n",
+ "class ObjectCountAdalComponent(adal.AdalComponent):# noqa: F811\n",
+ " def __init__(\n",
+ " self,\n",
+ " model_client: adal.ModelClient,\n",
+ " model_kwargs: Dict,\n",
+ " backward_engine_model_config: Dict,\n",
+ " teacher_model_config: Dict,\n",
+ " text_optimizer_model_config: Dict,\n",
+ " ):\n",
+ " task = ObjectCountTaskPipeline(model_client, model_kwargs)\n",
+ " eval_fn = AnswerMatchAcc(type=\"exact_match\").compute_single_item\n",
+ " loss_fn = adal.EvalFnToTextLoss(\n",
+ " eval_fn=eval_fn,\n",
+ " eval_fn_desc=\"exact_match: 1 if str(y) == str(y_gt) else 0\",\n",
+ " )\n",
+ " super().__init__(task=task, eval_fn=eval_fn, loss_fn=loss_fn)\n",
+ "\n",
+ " self.backward_engine_model_config = backward_engine_model_config\n",
+ " self.teacher_model_config = teacher_model_config\n",
+ " self.text_optimizer_model_config = text_optimizer_model_config\n",
+ "\n",
+ " def prepare_task(self, sample: Example):\n",
+ " return self.task.call, {\"question\": sample.question, \"id\": sample.id}\n",
+ "\n",
+ "\n",
+ " def prepare_eval(\n",
+ " self, sample: Example, y_pred: adal.GeneratorOutput\n",
+ " ) -> float:\n",
+ " y_label = -1\n",
+ " if (y_pred is not None and y_pred.data is not None): # if y_pred and y_pred.data: might introduce bug when the data is 0\n",
+ " y_label = y_pred.data\n",
+ " return self.eval_fn, {\"y\": y_label, \"y_gt\": sample.answer}\n",
+ "\n",
+ " def prepare_loss(self, sample: Example, pred: adal.Parameter):\n",
+ " # prepare gt parameter\n",
+ " y_gt = adal.Parameter(\n",
+ " name=\"y_gt\",\n",
+ " data=sample.answer,\n",
+ " eval_input=sample.answer,\n",
+ " requires_opt=False,\n",
+ " )\n",
+ "\n",
+ " # pred's full_response is the output of the task pipeline which is GeneratorOutput\n",
+ " pred.eval_input = pred.full_response.data\n",
+ " return self.loss_fn, {\"kwargs\": {\"y\": pred, \"y_gt\": y_gt}}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "dezwX2yn1eQS"
+ },
+ "outputs": [],
+ "source": [
+ "def train(\n",
+ " train_batch_size=4, # larger batch size is not that effective, probably because of llm's lost in the middle\n",
+ " raw_shots: int = 0,\n",
+ " bootstrap_shots: int = 1,\n",
+ " max_steps=1,\n",
+ " num_workers=4,\n",
+ " strategy=\"random\",\n",
+ " optimization_order=\"sequential\",\n",
+ " debug=False,\n",
+ " resume_from_ckpt=None,\n",
+ " exclude_input_fields_from_bootstrap_demos=False,\n",
+ "):\n",
+ " adal_component = ObjectCountAdalComponent(\n",
+ " **gpt_3_model,\n",
+ " teacher_model_config=gpt_4o_model,\n",
+ " text_optimizer_model_config=gpt_4o_model,\n",
+ " backward_engine_model_config=gpt_4o_model\n",
+ " )\n",
+ " print(adal_component)\n",
+ " trainer = adal.Trainer(\n",
+ " train_batch_size=train_batch_size,\n",
+ " adaltask=adal_component,\n",
+ " strategy=strategy,\n",
+ " max_steps=max_steps,\n",
+ " num_workers=num_workers,\n",
+ " raw_shots=raw_shots,\n",
+ " bootstrap_shots=bootstrap_shots,\n",
+ " debug=debug,\n",
+ " weighted_sampling=True,\n",
+ " optimization_order=optimization_order,\n",
+ " exclude_input_fields_from_bootstrap_demos=exclude_input_fields_from_bootstrap_demos,\n",
+ " )\n",
+ " print(trainer)\n",
+ "\n",
+ " train_dataset, val_dataset, test_dataset = load_datasets()\n",
+ " trainer.fit(\n",
+ " train_dataset=train_dataset,\n",
+ " val_dataset=val_dataset,\n",
+ " test_dataset=test_dataset,\n",
+ " debug=debug,\n",
+ " resume_from_ckpt=resume_from_ckpt,\n",
+ " )\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "NGKYozGt60Pp"
+ },
+ "source": [
+ "We use `Sequential` in default, we will end up with 24 steps in total, 12 for text optimizer and 12 for the demo optimizer."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
},
+ "id": "yDwLwL0L7Rsw",
+ "outputId": "1b7e413b-a1d3-4388-fc0c-ca4b1c072585"
+ },
+ "outputs": [
{
- "cell_type": "markdown",
- "metadata": {
- "id": "VAVtXE9xeEHt"
- },
- "source": [
- "### Soft link to AdalFlow default file path\n",
- "\n",
- "Lets' match the default to the current project, so that you can see the downloaded data and later the checkpoints of the training."
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "1SaKH6dkeWus"
- },
- "outputs": [],
- "source": [
- "! ln -s /root/.adalflow /content/adalflow\n",
- "\n",
- "# go to files then you will see a folder named as adalflow"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
+ "ObjectCountAdalComponent(\n",
+ " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
+ " (task): ObjectCountTaskPipeline(\n",
+ " (llm_counter): Generator(\n",
+ " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ " )\n",
+ " )\n",
+ " (loss_fn): EvalFnToTextLoss()\n",
+ ")\n",
+ "Trainer(\n",
+ " (adaltask): ObjectCountAdalComponent(\n",
+ " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
+ " (task): ObjectCountTaskPipeline(\n",
+ " (llm_counter): Generator(\n",
+ " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ " )\n",
+ " )\n",
+ " (loss_fn): EvalFnToTextLoss()\n",
+ " )\n",
+ ")\n",
+ "raw_shots: 0, bootstrap_shots: 1\n",
+ "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
+ "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
+ "Configuring teacher generator for Generator(\n",
+ " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ ")\n",
+ "Teacher generator set: Generator(\n",
+ " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ "), teacher Generator(\n",
+ " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
+ " (prompt): Prompt(\n",
+ " template: \n",
+ " {{system_prompt}}\n",
+ " {# Few shot demos #}\n",
+ " {% if few_shot_demos is not none %}\n",
+ " Here are some examples:\n",
+ " {{few_shot_demos}}\n",
+ " {% endif %}\n",
+ " \n",
+ " \n",
+ " {{input_str}}\n",
+ " \n",
+ " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
+ " )\n",
+ " (model_client): OpenAIClient()\n",
+ " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
+ ")\n",
+ "Teacher generator configured.\n",
+ "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
+ "Backward engine configured for all generators.\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "YWZzOvAHenME"
- },
- "source": [
- "# π AdalComponent to define everything we need to train\n",
- "\n",
- "1. We need `backward_engine_model_config`` for ``backward_engine`` to compute gradient.\n",
- "\n",
- "2. We need ``text_optimizer_model_config`` for the `text optimizer` for propose new prompts.\n",
- "\n",
- "3. For the demo optimizer, we need a `teacher_model_config` to config a teacher generator, in this case, it is the `llm_counter`. The teacher will share the same prompt with the `llm_counter` but you can use a more advanced model.\n",
- "\n",
- "In general, we should have all of these parts to use a more advanced model."
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 6482.70it/s]\n",
+ "Evaluating step(0): 0.8 across 50 samples, Max potential: 0.8: 100%|ββββββββββ| 50/50 [00:00<00:00, 347.01it/s]\n",
+ "Loading Data: 100%|ββββββββββ| 100/100 [00:00<00:00, 2017.67it/s]\n",
+ "Evaluating step(0): 0.83 across 100 samples, Max potential: 0.83: 100%|ββββββββββ| 100/100 [00:00<00:00, 286.59it/s]\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "9QoNoMWD0rgV"
- },
- "source": [
- "## π§ Diagnose\n",
- "\n",
- "Diagnose is more of an evaluation, but with detailed logs so that you can manually inspect the wrong output.\n",
- "\n",
- "This one shows the minimum config you need to get the `diagnose` work."
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Initial validation score: 0.8\n",
+ "Initial test score: 0.83\n",
+ "Checkpoint path: /root/.adalflow/ckpt/ObjectCountAdalComponent\n",
+ "save to /root/.adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "6mi7lM3U24Eg"
- },
- "outputs": [],
- "source": [
- "from adalflow.datasets.types import Example\n",
- "from adalflow.eval.answer_match_acc import AnswerMatchAcc\n",
- "\n",
- "\n",
- "class ObjectCountAdalComponent(adal.AdalComponent):\n",
- " def __init__(self, model_client: adal.ModelClient, model_kwargs: Dict):\n",
- " task = ObjectCountTaskPipeline(model_client, model_kwargs)\n",
- " eval_fn = AnswerMatchAcc(type=\"exact_match\").compute_single_item\n",
- " super().__init__(task=task, eval_fn=eval_fn)\n",
- "\n",
- " def prepare_task(self, sample: Example):\n",
- " return self.task.call, {\"question\": sample.question, \"id\": sample.id}\n",
- "\n",
- " def prepare_eval(\n",
- " self, sample: Example, y_pred: adal.GeneratorOutput\n",
- " ) -> float:\n",
- " y_label = -1\n",
- " if (y_pred is not None and y_pred.data is not None): # if y_pred and y_pred.data: might introduce bug when the data is 0\n",
- " y_label = y_pred.data\n",
- " return self.eval_fn, {\"y\": y_label, \"y_gt\": sample.answer}"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Training Step: 1: 0%| | 0/13 [00:00, ?it/s]\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 133.39it/s]\n",
+ "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 1489.32it/s]\n",
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 262.46it/s]\n",
+ "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12865.96it/s]\n",
+ "Training Step: 2: 8%|β | 1/13 [00:00<00:01, 8.29it/s]"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "eliPeVeM2wcP"
- },
- "outputs": [],
- "source": [
- "def diagnose(\n",
- " model_client: adal.ModelClient,\n",
- " model_kwargs: Dict,\n",
- ") -> Dict:\n",
- "\n",
- " trainset, valset, testset = load_datasets()\n",
- " # use max_samples=10 to test the code\n",
- "\n",
- " adal_component = ObjectCountAdalComponent(model_client, model_kwargs)\n",
- " trainer = adal.Trainer(adaltask=adal_component)\n",
- " trainer.diagnose(dataset=trainset, split=\"train\")\n",
- " trainer.diagnose(dataset=valset, split=\"val\")\n",
- " trainer.diagnose(dataset=testset, split=\"test\")"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Skipping batch 0 as acc: 1.0\n",
+ "No proposal can improve the subset and full set, go to next step\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "nKl9clcb3dFj",
- "outputId": "676fbb96-c70b-40ab-ea15-93ade1aa9e66"
- },
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
- "Checkpoint path: /root/.adalflow/ckpt/ObjectCountAdalComponent\n",
- "Save diagnose to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_train\n",
- "Saving traces to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_train\n",
- "all_generators: [('llm_counter', Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "))]\n",
- "Registered callback for llm_counter, file path: /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_train/llm_counter_call.jsonl\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 5957.82it/s]\n",
- "Evaluating step(0): 0.88 across 50 samples, Max potential: 0.88: 100%|ββββββββββ| 50/50 [00:15<00:00, 3.27it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sorted_indices: [8, 16, 23, 25, 31, 47, 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49]\n",
- "sorted_scores: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]\n",
- "Loading log file: llm_counter_call.jsonl\n",
- "Total error samples: 6\n",
- "Save diagnose to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_val\n",
- "Saving traces to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_val\n",
- "all_generators: [('llm_counter', Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "))]\n",
- "Registered callback for llm_counter, file path: /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_val/llm_counter_call.jsonl\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3203.76it/s]\n",
- "Evaluating step(0): 0.8 across 50 samples, Max potential: 0.8: 100%|ββββββββββ| 50/50 [00:15<00:00, 3.26it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sorted_indices: [1, 2, 5, 10, 24, 36, 38, 42, 44, 47, 0, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 39, 40, 41, 43, 45, 46, 48, 49]\n",
- "sorted_scores: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]\n",
- "Loading log file: llm_counter_call.jsonl\n",
- "Total error samples: 10\n",
- "Save diagnose to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_test\n",
- "Saving traces to /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_test\n",
- "all_generators: [('llm_counter', Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "))]\n",
- "Registered callback for llm_counter, file path: /root/.adalflow/ckpt/ObjectCountAdalComponent/diagnose_test/llm_counter_call.jsonl\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Loading Data: 100%|ββββββββββ| 100/100 [00:00<00:00, 5545.09it/s]\n",
- "Evaluating step(0): 0.83 across 100 samples, Max potential: 0.83: 100%|ββββββββββ| 100/100 [00:28<00:00, 3.50it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sorted_indices: [7, 18, 19, 20, 23, 24, 25, 43, 58, 59, 63, 74, 75, 79, 85, 97, 99, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 21, 22, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98]\n",
- "sorted_scores: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]\n",
- "Loading log file: llm_counter_call.jsonl\n",
- "Total error samples: 17\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n"
- ]
- }
- ],
- "source": [
- "diagnose(**gpt_3_model)"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 384.73it/s]\n",
+ "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 927.64it/s]\n",
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 754.71it/s]\n",
+ "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12087.33it/s]\n",
+ "Training Step: 3: 15%|ββ | 2/13 [00:00<00:01, 8.92it/s]"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "dSu4VQri3y3D"
- },
- "source": [
- "Now, you can go to `/content/adalflow/ckpt/ObjectCountAdalComponent/diagnose_train/stats.json` to view the average score for each split. And also the `diagnose.json` for different errors.\n",
- "\n",
- "Here is the overall score for each split.\n",
- "\n",
- "| Train | Val| Test |\n",
- "|:--------- |:--------:| ---------:|\n",
- "| 0.88 | 0.8 | 0.83 |\n",
- "\n"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Skipping batch 1 as acc: 1.0\n",
+ "No proposal can improve the subset and full set, go to next step\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "1vzJyp-W0z7I"
- },
- "source": [
- "## π Debug"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 193.44it/s]\n",
+ "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 2761.68it/s]\n",
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 810.38it/s]\n",
+ "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 11320.66it/s]\n",
+ "Training Step: 4: 15%|ββ | 2/13 [00:00<00:01, 8.92it/s]"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "TmlCvJu804dJ"
- },
- "source": [
- "## β
Train\n",
- "\n",
- "Now, let's start training."
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Skipping batch 2 as acc: 1.0\n",
+ "No proposal can improve the subset and full set, go to next step\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "4TWCn0did6-K"
- },
- "outputs": [],
- "source": [
- "from adalflow.datasets.types import Example\n",
- "from adalflow.eval.answer_match_acc import AnswerMatchAcc\n",
- "\n",
- "\n",
- "class ObjectCountAdalComponent(adal.AdalComponent):\n",
- " def __init__(\n",
- " self,\n",
- " model_client: adal.ModelClient,\n",
- " model_kwargs: Dict,\n",
- " backward_engine_model_config: Dict,\n",
- " teacher_model_config: Dict,\n",
- " text_optimizer_model_config: Dict,\n",
- " ):\n",
- " task = ObjectCountTaskPipeline(model_client, model_kwargs)\n",
- " eval_fn = AnswerMatchAcc(type=\"exact_match\").compute_single_item\n",
- " loss_fn = adal.EvalFnToTextLoss(\n",
- " eval_fn=eval_fn,\n",
- " eval_fn_desc=\"exact_match: 1 if str(y) == str(y_gt) else 0\",\n",
- " )\n",
- " super().__init__(task=task, eval_fn=eval_fn, loss_fn=loss_fn)\n",
- "\n",
- " self.backward_engine_model_config = backward_engine_model_config\n",
- " self.teacher_model_config = teacher_model_config\n",
- " self.text_optimizer_model_config = text_optimizer_model_config\n",
- "\n",
- " def prepare_task(self, sample: Example):\n",
- " return self.task.call, {\"question\": sample.question, \"id\": sample.id}\n",
- "\n",
- "\n",
- " def prepare_eval(\n",
- " self, sample: Example, y_pred: adal.GeneratorOutput\n",
- " ) -> float:\n",
- " y_label = -1\n",
- " if (y_pred is not None and y_pred.data is not None): # if y_pred and y_pred.data: might introduce bug when the data is 0\n",
- " y_label = y_pred.data\n",
- " return self.eval_fn, {\"y\": y_label, \"y_gt\": sample.answer}\n",
- "\n",
- " def prepare_loss(self, sample: Example, pred: adal.Parameter):\n",
- " # prepare gt parameter\n",
- " y_gt = adal.Parameter(\n",
- " name=\"y_gt\",\n",
- " data=sample.answer,\n",
- " eval_input=sample.answer,\n",
- " requires_opt=False,\n",
- " )\n",
- "\n",
- " # pred's full_response is the output of the task pipeline which is GeneratorOutput\n",
- " pred.eval_input = pred.full_response.data\n",
- " return self.loss_fn, {\"kwargs\": {\"y\": pred, \"y_gt\": y_gt}}"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 234.44it/s]\n",
+ "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 2487.72it/s]\n",
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 1024.88it/s]\n",
+ "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12018.06it/s]\n",
+ "Training Step: 5: 31%|βββ | 4/13 [00:00<00:00, 11.90it/s]"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "dezwX2yn1eQS"
- },
- "outputs": [],
- "source": [
- "def train(\n",
- " train_batch_size=4, # larger batch size is not that effective, probably because of llm's lost in the middle\n",
- " raw_shots: int = 0,\n",
- " bootstrap_shots: int = 1,\n",
- " max_steps=1,\n",
- " num_workers=4,\n",
- " strategy=\"random\",\n",
- " optimization_order=\"sequential\",\n",
- " debug=False,\n",
- " resume_from_ckpt=None,\n",
- " exclude_input_fields_from_bootstrap_demos=False,\n",
- "):\n",
- " adal_component = ObjectCountAdalComponent(\n",
- " **gpt_3_model,\n",
- " teacher_model_config=gpt_4o_model,\n",
- " text_optimizer_model_config=gpt_4o_model,\n",
- " backward_engine_model_config=gpt_4o_model\n",
- " )\n",
- " print(adal_component)\n",
- " trainer = adal.Trainer(\n",
- " train_batch_size=train_batch_size,\n",
- " adaltask=adal_component,\n",
- " strategy=strategy,\n",
- " max_steps=max_steps,\n",
- " num_workers=num_workers,\n",
- " raw_shots=raw_shots,\n",
- " bootstrap_shots=bootstrap_shots,\n",
- " debug=debug,\n",
- " weighted_sampling=True,\n",
- " optimization_order=optimization_order,\n",
- " exclude_input_fields_from_bootstrap_demos=exclude_input_fields_from_bootstrap_demos,\n",
- " )\n",
- " print(trainer)\n",
- "\n",
- " train_dataset, val_dataset, test_dataset = load_datasets()\n",
- " trainer.fit(\n",
- " train_dataset=train_dataset,\n",
- " val_dataset=val_dataset,\n",
- " test_dataset=test_dataset,\n",
- " debug=debug,\n",
- " resume_from_ckpt=resume_from_ckpt,\n",
- " )\n"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Skipping batch 3 as acc: 1.0\n",
+ "No proposal can improve the subset and full set, go to next step\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "NGKYozGt60Pp"
- },
- "source": [
- "We use `Sequential` in default, we will end up with 24 steps in total, 12 for text optimizer and 12 for the demo optimizer."
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 133.95it/s]\n",
+ "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 4552.84it/s]\n",
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 392.05it/s]\n",
+ "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 770.69it/s]\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "yDwLwL0L7Rsw",
- "outputId": "1b7e413b-a1d3-4388-fc0c-ca4b1c072585"
- },
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
- "ObjectCountAdalComponent(\n",
- " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
- " (task): ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- " )\n",
- " (loss_fn): EvalFnToTextLoss()\n",
- ")\n",
- "Trainer(\n",
- " (adaltask): ObjectCountAdalComponent(\n",
- " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
- " (task): ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- " )\n",
- " (loss_fn): EvalFnToTextLoss()\n",
- " )\n",
- ")\n",
- "raw_shots: 0, bootstrap_shots: 1\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator configured.\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Backward engine configured for all generators.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 6482.70it/s]\n",
- "Evaluating step(0): 0.8 across 50 samples, Max potential: 0.8: 100%|ββββββββββ| 50/50 [00:00<00:00, 347.01it/s]\n",
- "Loading Data: 100%|ββββββββββ| 100/100 [00:00<00:00, 2017.67it/s]\n",
- "Evaluating step(0): 0.83 across 100 samples, Max potential: 0.83: 100%|ββββββββββ| 100/100 [00:00<00:00, 286.59it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Initial validation score: 0.8\n",
- "Initial test score: 0.83\n",
- "Checkpoint path: /root/.adalflow/ckpt/ObjectCountAdalComponent\n",
- "save to /root/.adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training Step: 1: 0%| | 0/13 [00:00, ?it/s]\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 133.39it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 1489.32it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 262.46it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12865.96it/s]\n",
- "Training Step: 2: 8%|β | 1/13 [00:00<00:01, 8.29it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 0 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 384.73it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 927.64it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 754.71it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12087.33it/s]\n",
- "Training Step: 3: 15%|ββ | 2/13 [00:00<00:01, 8.92it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 1 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 193.44it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 2761.68it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 810.38it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 11320.66it/s]\n",
- "Training Step: 4: 15%|ββ | 2/13 [00:00<00:01, 8.92it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 2 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 234.44it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 2487.72it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 1024.88it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12018.06it/s]\n",
- "Training Step: 5: 31%|βββ | 4/13 [00:00<00:00, 11.90it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 3 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 133.95it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 4552.84it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 392.05it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 770.69it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.75\n",
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "setting pred name Generator_outputy_pred_3 score to 0.0\n",
- "Subset loss backward time: 5.383355617523193\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 225.14it/s]\n",
- "Evaluating step(4): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.43it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 445.28it/s]\n",
- "Evaluating step(4): 1.0 across 4 samples, Max potential: 1.0: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.67it/s]\n",
- "Proposing: 0%| | 0/5 [00:03, ?it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 1.0 >= 0.75\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1139.66it/s]\n",
- "Evaluating step(5): 0.84 across 50 samples, Max potential: 0.84: 100%|ββββββββββ| 50/50 [00:16<00:00, 3.04it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer step: 0.84 > 0.8\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 100/100 [00:00<00:00, 1658.72it/s]\n",
- "Evaluating step(4): 0.91 across 100 samples, Max potential: 0.91: 100%|ββββββββββ| 100/100 [00:29<00:00, 3.37it/s]\n",
- "Training Step: 6: 38%|ββββ | 5/13 [00:56<02:18, 17.27s/it]\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 207.97it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.86it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 494.99it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 805.09it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.75\n",
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 0.0\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "Subset loss backward time: 4.081957817077637\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 538.35it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 3.13it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:08, 2.13s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 151.18it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 204.61it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:03<00:04, 1.66s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 698.62it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 571.41it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:05<00:03, 1.61s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, especially when quantities are specified. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 116.83it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.50it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:07<00:01, 1.88s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 399.65it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 571.09it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:08<00:00, 1.69s/it]\n",
- "Training Step: 7: 46%|βββββ | 6/13 [01:09<01:53, 16.18s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 59.06it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:02<00:00, 1.63it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 410.78it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 4694.24it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 7\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.875\n",
- "Moving batch correct size: 7\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "Subset loss backward time: 3.0843119621276855\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item individually and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 154.50it/s]\n",
- "Evaluating step(6): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 1.52it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 8/8 [00:00<00:00, 279.47it/s]\n",
- "Evaluating step(6): 0.875 across 8 samples, Max potential: 0.875: 100%|ββββββββββ| 8/8 [00:01<00:00, 4.43it/s]\n",
- "Proposing: 0%| | 0/5 [00:04, ?it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 0.875 >= 0.875\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2336.58it/s]\n",
- "Evaluating step(7): 0.84 across 50 samples, Max potential: 0.84: 100%|ββββββββββ| 50/50 [00:17<00:00, 2.88it/s]\n",
- "Training Step: 8: 54%|ββββββ | 7/13 [01:37<01:58, 19.81s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer revert: 0.84 <= 0.84\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 148.75it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.04it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 345.11it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 7550.50it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 11\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.9166666666666666\n",
- "Moving batch correct size: 11\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "Subset loss backward time: 2.337067127227783\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item individually, especially when quantities are specified. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 193.84it/s]\n",
- "Evaluating step(7): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.16it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:09, 2.39s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item individually, especially when quantities are specified in words. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 147.89it/s]\n",
- "Evaluating step(7): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.04it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:04<00:07, 2.41s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item individually, especially when quantities are specified. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 423.61it/s]\n",
- "Evaluating step(7): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 556.86it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:05<00:03, 1.78s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item individually, especially when quantities are specified. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 532.41it/s]\n",
- "Evaluating step(7): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 522.78it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:06<00:01, 1.44s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item individually, especially when quantities are specified in words. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 284.18it/s]\n",
- "Evaluating step(7): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 160.35it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:07<00:00, 1.59s/it]\n",
- "Training Step: 9: 62%|βββββββ | 8/13 [01:50<01:27, 17.55s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 87.73it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.62it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 342.85it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 7157.52it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 14\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.875\n",
- "Moving batch correct size: 14\n",
- "Moving batch error size: 2\n",
- "Subset Error size: 2\n",
- "Subset Correct size: 4\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_0 score to 0.0\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "Subset loss backward time: 7.823317050933838\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 166.50it/s]\n",
- "Evaluating step(8): 0.8333 across 6 samples, Max potential: 0.8333: 100%|ββββββββββ| 6/6 [00:02<00:00, 2.78it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 0.8333333333333334 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 16/16 [00:00<00:00, 481.75it/s]\n",
- "Evaluating step(8): 0.875 across 16 samples, Max potential: 0.875: 100%|ββββββββββ| 16/16 [00:03<00:00, 5.21it/s]\n",
- "Proposing: 0%| | 0/5 [00:06, ?it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 0.875 >= 0.875\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1112.82it/s]\n",
- "Evaluating step(9): 0.86 across 50 samples, Max potential: 0.86: 100%|ββββββββββ| 50/50 [00:16<00:00, 2.97it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer step: 0.86 > 0.84\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 100/100 [00:00<00:00, 2395.58it/s]\n",
- "Evaluating step(8): 0.87 across 100 samples, Max potential: 0.87: 100%|ββββββββββ| 100/100 [00:30<00:00, 3.30it/s]\n",
- "Training Step: 10: 69%|βββββββ | 9/13 [02:52<02:04, 31.23s/it]\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 212.83it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.04it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 655.18it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1241.84it/s]\n",
- "Training Step: 11: 77%|ββββββββ | 10/13 [02:55<01:07, 22.43s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 9 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 93.95it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.23it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 757.71it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1320.62it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.75\n",
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 0.0\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "Subset loss backward time: 3.768970012664795\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, ensuring you categorize them correctly. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 125.10it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.77it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:08, 2.19s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, ensuring you categorize them correctly. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 571.28it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 429.07it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:03<00:04, 1.58s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to categories and quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 111.64it/s]\n",
- "Evaluating step(10): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.63it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 455.77it/s]\n",
- "Evaluating step(10): 1.0 across 4 samples, Max potential: 1.0: 100%|ββββββββββ| 4/4 [00:00<00:00, 5.14it/s]\n",
- "Proposing: 40%|ββββ | 2/5 [00:06<00:09, 3.17s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 1.0 >= 0.75\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1732.93it/s]\n",
- "Evaluating step(11): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:18<00:04, 2.21it/s]\n",
- "Training Step: 12: 85%|βββββββββ | 11/13 [03:24<00:49, 24.61s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer revert: 0.8048780487804879 <= 0.86\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 128.86it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.24it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 470.20it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 2608.40it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 6\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.75\n",
- "Moving batch correct size: 6\n",
- "Moving batch error size: 2\n",
- "Subset Error size: 2\n",
- "Subset Correct size: 4\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 0.0\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "Subset loss backward time: 6.722561836242676\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, ensuring you categorize them correctly. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 265.78it/s]\n",
- "Evaluating step(11): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:01<00:00, 3.58it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:10, 2.65s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, ensuring you categorize them correctly. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 396.33it/s]\n",
- "Evaluating step(11): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 354.51it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:03<00:05, 1.80s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, ensuring you categorize them correctly. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 789.39it/s]\n",
- "Evaluating step(11): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 233.79it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:04<00:02, 1.49s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each relevant item, excluding any that do not fit the category. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 181.12it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:02<00:00, 2.13it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:08<00:02, 2.44s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each relevant item, excluding any that do not fit the category. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 807.04it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:00<00:00, 275.78it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:10<00:00, 2.01s/it]\n",
- "Training Step: 12: 92%|ββββββββββ| 12/13 [03:43<00:18, 18.61s/it]\n",
- "Epoch: 100%|ββββββββββ| 1/1 [03:43<00:00, 223.37s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n",
- "Reached max steps\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " You are the feedback engine in an optimization system.\n",
- " \n",
- " Your role: Provide intelligent and creative feedback for the variable enclosed in tags, based on the objective specified in tags.\n",
- " 1. Focus on the downstream OBJECTIVE without proposing new versions of the variable.\n",
- " 2. Feedback examples: \"Since language models have the X failure mode...\", \"Adding X can fix this error because...\", \"Removing X can improve the objective function because...\", \"Changing X to Y would fix the mistake...\"\n",
- " 3. Consider the variable in the context of its peers if provided.\n",
- " Remember:\n",
- " Be concise, critical, and direct.\n",
- " \n",
- " \n",
- " {{conversation_sec}}\n",
- " \n",
- " {{objective_instruction_sec}}\n",
- " , prompt_variables: ['objective_instruction_sec', 'conversation_sec']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " You are the feedback engine in an optimization system.\n",
- " \n",
- " Your role: Provide intelligent and creative feedback for the variable enclosed in tags, based on the objective specified in tags.\n",
- " 1. Focus on the downstream OBJECTIVE without proposing new versions of the variable.\n",
- " 2. Feedback examples: \"Since language models have the X failure mode...\", \"Adding X can fix this error because...\", \"Removing X can improve the objective function because...\", \"Changing X to Y would fix the mistake...\"\n",
- " 3. Consider the variable in the context of its peers if provided.\n",
- " Remember:\n",
- " Be concise, critical, and direct.\n",
- " \n",
- " \n",
- " {{conversation_sec}}\n",
- " \n",
- " {{objective_instruction_sec}}\n",
- " , prompt_variables: ['objective_instruction_sec', 'conversation_sec']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " You are the feedback engine in an optimization system.\n",
- " \n",
- " Your role: Provide intelligent and creative feedback for the variable enclosed in tags, based on the objective specified in tags.\n",
- " 1. Focus on the downstream OBJECTIVE without proposing new versions of the variable.\n",
- " 2. Feedback examples: \"Since language models have the X failure mode...\", \"Adding X can fix this error because...\", \"Removing X can improve the objective function because...\", \"Changing X to Y would fix the mistake...\"\n",
- " 3. Consider the variable in the context of its peers if provided.\n",
- " Remember:\n",
- " Be concise, critical, and direct.\n",
- " \n",
- " \n",
- " {{conversation_sec}}\n",
- " \n",
- " {{objective_instruction_sec}}\n",
- " , prompt_variables: ['objective_instruction_sec', 'conversation_sec']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- ")\n",
- "Teacher generator configured.\n",
- "save to /root/.adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n",
- "Starting step: 12\n",
- "trainer_results: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training Step: 13: 0%| | 0/12 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 13\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 158.10it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 6c34d6e5-0e3d-4243-834e-fd6c5883f467 already exists. Updating the trace.Trace with id 234e39df-1bc4-41df-a515-895cb2614a53 already exists. Updating the trace.\n",
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.35it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 8895d6bd-eab0-48af-ad4b-51f8007258b1 already exists. Updating the trace.\n",
- "Trace with id c42fea48-1b90-4388-92c4-b65b4356a3a2 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 490.46it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1656.19it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 247.40it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.77it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 365.97it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 9294.86it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['c42fea48-1b90-4388-92c4-b65b4356a3a2']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Trombone: 1\\n\\n 2. Violin: 1\\n\\n 3. Clarinet: 1\\n\\n 4. Accordion: 1\\n\\n 5. Flutes: 4\\n\\n 6. Trumpet: 1\\n\\n 7. Drums: 2\\n\\n 8. Piano: 1\\n\\n\\n Now, let''s add them up:\\n\\n\\n 1 + 1 + 1 + 1 + 4 + 1 + 2 + 1 = 12\\n\\n\\n Answer: 12'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2578.13it/s]\n",
- "Evaluating step(13): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:23<00:13, 1.35it/s]\n",
- "Training Step: 14: 17%|ββ | 2/12 [00:27<04:35, 27.54s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 14\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 136.94it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id fd34672a-ffd1-498e-a88f-283aa9d4f65d already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.92it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 46a8994f-fce6-4031-b251-1c8af31d88d2 already exists. Updating the trace.\n",
- "Trace with id 2bc992c0-9832-47f1-87c3-9f6e4b18ee99 already exists. Updating the trace.\n",
- "Trace with id 12a6ff3d-f54d-4d89-b5f0-1aec30e96398 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 443.10it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 3302.60it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 114.14it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.59it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 685.93it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 5111.89it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1784.60it/s]\n",
- "Evaluating step(14): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:19<00:11, 1.61it/s]\n",
- "Training Step: 15: 33%|ββββ | 4/12 [00:52<02:10, 16.36s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 15\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 164.67it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 660c5004-35d2-4a6d-9a06-1e0b3f032f21 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 25%|βββ | 1/4 [00:00<00:02, 1.12it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id d3f33ded-170a-4b87-9b0b-987d5fb7b817 already exists. Updating the trace.\n",
- "Trace with id de4e75d6-a21b-4004-925d-a9a818bd0f7c already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.02it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 1f682cab-026c-4803-8018-a45d027aa026 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 665.05it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1875.18it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 160.86it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.14it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 621.42it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 9054.08it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2982.93it/s]\n",
- "Evaluating step(15): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 495.97it/s]\n",
- "Training Step: 16: 42%|βββββ | 5/12 [00:56<01:03, 9.03s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 16\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 127.68it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 0e8910c8-703d-4766-a483-c5691125fd03 already exists. Updating the trace.Trace with id ffe67a7b-7b81-4302-b6ed-4b506570274b already exists. Updating the trace.\n",
- "Trace with id e250f80e-334e-4f85-ac1f-df9a2013d578 already exists. Updating the trace.\n",
- "Trace with id fe9b883c-4f47-44f7-a388-b03a2fb10413 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 534.68it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 201.71it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 10453.09it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 195.85it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.52it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 560.49it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1250.72it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3902.04it/s]\n",
- "Evaluating step(16): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 398.91it/s]\n",
- "Training Step: 17: 58%|ββββββ | 7/12 [00:58<00:35, 7.16s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 17\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 0%| | 0/4 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id d46e538c-832d-4eb5-ba9b-a308f666baba already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\rLoading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 106.99it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id a9a202f5-e723-4d24-ae5e-ad1084a52ef8 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 75%|ββββββββ | 3/4 [00:00<00:00, 3.09it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 74d1bc97-46cd-406d-8c3a-2f999aae1b2f already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.92it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 334.77it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 874.86it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 370.55it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.81it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 482.84it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 645.40it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2888.08it/s]\n",
- "Evaluating step(17): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 221.76it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 18: 67%|βββββββ | 8/12 [01:02<00:19, 4.87s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 18\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 111.28it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id d4194dd1-739a-4509-8ac8-7c3f89649ee7 already exists. Updating the trace.Trace with id 1eb770ed-ff6f-481e-8c16-b9749a44a1a6 already exists. Updating the trace.\n",
- "Trace with id 7694df14-3a24-40bd-a3fa-036c2645eca3 already exists. Updating the trace.\n",
- "\n",
- "Trace with id 4cd9f4ec-2648-4e85-8e17-3dae1b8558d3 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 585.96it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 225.18it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1038.07it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 250.95it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.18it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 438.82it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 2456.40it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2422.27it/s]\n",
- "Evaluating step(18): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 456.47it/s]\n",
- "Training Step: 19: 75%|ββββββββ | 9/12 [01:05<00:13, 4.41s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 19\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 57.52it/s]\n",
- "Training: 0%| | 0/4 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 5124e2e6-2aac-4dd3-ab63-9277a7b806a7 already exists. Updating the trace.\n",
- "Trace with id 1d3eceeb-ad24-40f6-8752-2f38241172cb already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.16it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 3a9a47c8-a210-43a4-8d24-b9159babb6e4 already exists. Updating the trace.Trace with id 6c0d3a9a-bb01-4fb3-a68b-1edf66861235 already exists. Updating the trace.\n",
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 193.38it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 6143.25it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 107.12it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.42it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 375.70it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 10505.46it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3644.75it/s]\n",
- "Evaluating step(19): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 275.17it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 20: 92%|ββββββββββ| 11/12 [01:09<00:04, 4.32s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 20\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 125.16it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id b538075d-01af-4b76-b835-9005f3044609 already exists. Updating the trace.\n",
- "Trace with id dd9d8748-4926-4bcd-902d-6a4c5cb38267 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\rTraining: 0%| | 0/4 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 60866bed-8020-4610-a39a-a4a730c035db already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 4.20it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 85d63f78-39c0-4753-a9fc-52202df48673 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 328.35it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 999.36it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 239.24it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:02<00:00, 1.87it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 353.26it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 391.07it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['60866bed-8020-4610-a39a-a4a730c035db']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Bed: 1\\n\\n 2. Fridge: 1\\n\\n 3. Lamp: 1\\n\\n 4. Toaster: 1\\n\\n 5. Chairs: 4\\n\\n 6. Table: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 1 + 1 + 4 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1763.23it/s]\n",
- "Evaluating step(20): 0.7083 across 24 samples, Max potential: 0.86: 48%|βββββ | 24/50 [00:17<00:18, 1.38it/s]\n",
- "Training Step: 21: 100%|ββββββββββ| 12/12 [01:34<00:00, 7.82s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.68 <= 0.86, revert\n",
- "Training Step: 21\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 208.10it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id aefd17e5-9682-4420-a820-c484a63d6dcd already exists. Updating the trace.\n",
- "Trace with id 04e77795-cc9b-4530-a883-5f775e3fbc76 already exists. Updating the trace.\n",
- "Trace with id 701be0ee-29e0-42f5-be04-72d2b73e3968 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 4.56it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 433650a5-ca75-4867-b235-3af4a7c55c67 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 187.26it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 2595.49it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 129.91it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.86it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 172.30it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 689.23it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3183.48it/s]\n",
- "Evaluating step(21): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 438.75it/s]\n",
- "Training Step: 22: : 13it [01:38, 6.76s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 22\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 0%| | 0/4 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 4dad0f65-d624-48c2-a795-596c00b0535a already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 86.81it/s]\n",
- "Training: 0%| | 0/4 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 1b4b3ab0-d20f-4fc2-a09c-4592a227a8e5 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.23it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 82cf82ff-d826-4bb1-847c-9938aeec8ff5 already exists. Updating the trace.\n",
- "Trace with id ac43f3d4-d67d-4912-95d6-0baa09b52d9a already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 143.58it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 842.95it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 133.83it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.36it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 326.14it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 307.38it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['60866bed-8020-4610-a39a-a4a730c035db']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Bed: 1\\n\\n 2. Fridge: 1\\n\\n 3. Lamp: 1\\n\\n 4. Toaster: 1\\n\\n 5. Chairs: 4\\n\\n 6. Table: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 1 + 1 + 4 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 5440.79it/s]\n",
- "Evaluating step(22): 0.7083 across 24 samples, Max potential: 0.86: 48%|βββββ | 24/50 [00:00<00:00, 303.26it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.68 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 23: : 14it [01:42, 6.13s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 23\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 91.93it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id daa5804f-1aad-4f01-b26c-6b31c57f065f already exists. Updating the trace.\n",
- "Trace with id e2bfbbe0-fb79-4df5-9a7d-50c9085947bc already exists. Updating the trace.\n",
- "Trace with id 71d549d2-9cc8-46ba-a7f6-d07f69263fd3 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.56it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 840d9ed5-8222-45a9-a406-7445feae9733 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 63.89it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 201.47it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 90.61it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:02<00:00, 1.96it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 287.69it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1938.89it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3010.90it/s]\n",
- "Evaluating step(23): 0.7812 across 32 samples, Max potential: 0.86: 64%|βββββββ | 32/50 [00:00<00:00, 423.98it/s]\n",
- "Training Step: 24: : 16it [01:48, 6.22s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.7575757575757576 <= 0.86, revert\n",
- "Training Step: 24\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 122.52it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 96c716a1-e984-4fe3-9ce0-e156ac709edb already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\rTraining: 0%| | 0/4 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 000a3738-1f09-40b0-9f8b-2dec63a3f7f8 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.21it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id d71ad721-d21d-42f1-af9b-719ff026406b already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 106.06it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1513.37it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 265.42it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.07it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 171.27it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 862.32it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['840d9ed5-8222-45a9-a406-7445feae9733']\n",
- "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item, paying special attention to quantities mentioned. Verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Table: 1\\n\\n 3. Fridge: 1\\n\\n 4. Stove: 1\\n\\n 5. Oven: 1\\n\\n 6. Toaster: 1\\n\\n 7. Couch: 1\\n\\n 8. Cars: 4\\n\\n\\n Now, add them up:\\n\\n\\n 1 + 1 + 1 + 1 + 1 + 1 + 1 + 4 = 11\\n\\n\\n Answer: 11'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1210.01it/s]\n",
- "Evaluating step(24): 0.86 across 50 samples, Max potential: 0.86: 100%|ββββββββββ| 50/50 [00:18<00:00, 2.69it/s]\n",
- "Training Step: 24: 100%|ββββββββββ| 12/12 [02:15<00:00, 11.26s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.86 <= 0.86, revert\n",
- "Saved ckpt to /root/.adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n",
- "Training time: 359.32386112213135s\n",
- "ckpt_file: /root/.adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n"
- ]
- }
- ],
- "source": [
- "train(debug=False, max_steps=12, strategy=\"constrained\",\n",
- " raw_shots=0, bootstrap_shots=1,\n",
- " exclude_input_fields_from_bootstrap_demos=True\n",
- " )"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Moving batch correct size: 3\n",
+ "Moving batch error size: 1\n",
+ "Moving batch acc: 0.75\n",
+ "Moving batch correct size: 3\n",
+ "Moving batch error size: 1\n",
+ "Subset Error size: 1\n",
+ "Subset Correct size: 2\n",
+ "Subset score: 0.6666666666666666\n",
+ "Subset batch acc: 0.6666666666666666\n",
+ "Subset loss backward...\n",
+ "setting pred name Generator_outputy_pred_1 score to 1.0\n",
+ "setting pred name Generator_outputy_pred_2 score to 1.0\n",
+ "setting pred name Generator_outputy_pred_3 score to 0.0\n",
+ "Subset loss backward time: 5.383355617523193\n",
+ "Optimizer propose...\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "KAyFhzrG_J4l"
- },
- "source": [
- "Here is our scores for each step:\n",
- "\n",
- "\"val_scores\": [\n",
- " 0.8,\n",
- " 0.8,\n",
- " 0.8,\n",
- " 0.8,\n",
- " 0.8,\n",
- " 0.84,\n",
- " 0.84,\n",
- " 0.84,\n",
- " 0.84,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86,\n",
- " 0.86\n",
- " ]\n",
- "\n",
- " \"test_scores\": [\n",
- " 0.83,\n",
- " 0.83,\n",
- " 0.83,\n",
- " 0.83,\n",
- " 0.83,\n",
- " 0.91,\n",
- " 0.91,\n",
- " 0.91,\n",
- " 0.91,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87,\n",
- " 0.87\n",
- " ]\n",
- "\n",
- "\n",
- "It is normal when the score of the validation does not exactly match to that of the test set. You can also train with just the test set. You can modify the fit arguments as\n",
- "\n",
- "```\n",
- "trainer.fit(\n",
- " train_dataset=train_dataset,\n",
- " val_dataset=test_dataset,\n",
- " # test_dataset=test_dataset,\n",
- " debug=debug,\n",
- " resume_from_ckpt=resume_from_ckpt,\n",
- " )\n",
- "```"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "953BV81y0JFv"
- },
- "source": [
- "# π₯ Resume Checkpoint\n",
- "\n",
- "We might want to continue from the earlier step and to train more steps\n",
- "\n",
- "This is easy to do.\n",
- "\n",
- "**Note: Ensure you copy the path you had, and replace it, as your run might create a different file name.**"
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "New prompts: [PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='2f948c14-7f8f-4f46-9e23-d30598d3f47b', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "kde1V1AE7Ty0",
- "outputId": "52d69b69-0a3a-4780-ca26-25956cc023c7"
- },
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
- "ObjectCountAdalComponent(\n",
- " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
- " (task): ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- " )\n",
- " (loss_fn): EvalFnToTextLoss()\n",
- ")\n",
- "Trainer(\n",
- " (adaltask): ObjectCountAdalComponent(\n",
- " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
- " (task): ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- " )\n",
- " (loss_fn): EvalFnToTextLoss()\n",
- " )\n",
- ")\n",
- "raw_shots: 0, bootstrap_shots: 1\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator configured.\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Backward engine configured for all generators.\n",
- "Restoring prompts: PromptData(id='44f6083f-4cf7-4a9a-bf10-20d218ee4106', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True)\n",
- "save to /content/adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training Step: 27: 0%| | 0/13 [00:00, ?it/s]\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 417.64it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 1073.40it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 571.14it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1126.21it/s]\n",
- "Training Step: 28: 0%| | 0/13 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 0 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 604.56it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:02<00:00, 1.83it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 540.00it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1445.81it/s]\n",
- "Training Step: 29: 15%|ββ | 2/13 [00:02<00:12, 1.15s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Skipping batch 1 as acc: 1.0\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 318.87it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 4.06it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 458.88it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1186.26it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.75\n",
- "Moving batch correct size: 3\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 0.0\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "Subset loss backward time: 4.518843650817871\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 142.52it/s]\n",
- "Evaluating step(2): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 1.56it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:11, 2.99s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities specified in the input. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 118.95it/s]\n",
- "Evaluating step(2): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 1.76it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:05<00:08, 2.85s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 129.26it/s]\n",
- "Evaluating step(2): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 1.54it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 263.51it/s]\n",
- "Evaluating step(2): 1.0 across 4 samples, Max potential: 1.0: 100%|ββββββββββ| 4/4 [00:00<00:00, 4.20it/s]\n",
- "Proposing: 40%|ββββ | 2/5 [00:10<00:15, 5.11s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 1.0 >= 0.75\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2287.37it/s]\n",
- "Evaluating step(29): 0.8158 across 38 samples, Max potential: 0.86: 76%|ββββββββ | 38/50 [00:17<00:05, 2.17it/s]\n",
- "Training Step: 30: 23%|βββ | 3/13 [00:35<02:25, 14.59s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer revert: 0.7948717948717948 <= 0.86\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 268.93it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.69it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 603.76it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 8825.47it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 7\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.875\n",
- "Moving batch correct size: 7\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "Subset loss backward time: 2.2182435989379883\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly and ensure you account for all items. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 160.12it/s]\n",
- "Evaluating step(3): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 1.72it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:11, 2.83s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly and ensure each item is counted correctly. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 89.23it/s]\n",
- "Evaluating step(3): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 1.66it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 8/8 [00:00<00:00, 281.73it/s]\n",
- "Evaluating step(3): 1.0 across 8 samples, Max potential: 1.0: 100%|ββββββββββ| 8/8 [00:02<00:00, 2.96it/s]\n",
- "Proposing: 20%|ββ | 1/5 [00:08<00:34, 8.54s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 1.0 >= 0.875\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1910.10it/s]\n",
- "Evaluating step(30): 0.72 across 25 samples, Max potential: 0.86: 50%|βββββ | 25/50 [00:18<00:18, 1.38it/s]\n",
- "Training Step: 31: 31%|βββ | 4/13 [01:05<03:03, 20.39s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer revert: 0.6923076923076923 <= 0.86\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 310.31it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.75it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 454.32it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 12336.19it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 11\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.9166666666666666\n",
- "Moving batch correct size: 11\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "Subset loss backward time: 2.028568983078003\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly and ensure each item is counted correctly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 121.52it/s]\n",
- "Evaluating step(4): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.10it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 12/12 [00:00<00:00, 724.90it/s]\n",
- "Evaluating step(4): 1.0 across 12 samples, Max potential: 1.0: 100%|ββββββββββ| 12/12 [00:03<00:00, 3.66it/s]\n",
- "Proposing: 0%| | 0/5 [00:05, ?it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 1.0 >= 0.9166666666666666\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2233.56it/s]\n",
- "Evaluating step(31): 0.8511 across 47 samples, Max potential: 0.86: 94%|ββββββββββ| 47/50 [00:16<00:01, 2.81it/s]\n",
- "Training Step: 32: 38%|ββββ | 5/13 [01:31<02:58, 22.30s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer revert: 0.8333333333333334 <= 0.86\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 269.31it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.20it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 606.49it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1212.58it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 15\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.9375\n",
- "Moving batch correct size: 15\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "Subset loss backward time: 3.2150633335113525\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 130.57it/s]\n",
- "Evaluating step(5): 0.5 across 2 samples, Max potential: 0.6667: 33%|ββββ | 1/3 [00:01<00:02, 1.39s/it]INFO:backoff:Backing off call(...) for 0.2s (openai.InternalServerError: \n",
- "500 Internal Server Error \n",
- "\n",
- "500 Internal Server Error \n",
- "nginx \n",
- "\n",
- ")\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:50<00:00, 16.89s/it]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:52<03:28, 52.11s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 645.05it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 298.94it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:53<01:07, 22.46s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 751.40it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 360.88it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:54<00:25, 12.66s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 332.13it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 276.08it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:55<00:08, 8.12s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 440.13it/s]\n",
- "Evaluating step(5): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 235.96it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:57<00:00, 11.41s/it]\n",
- "Training Step: 33: 46%|βββββ | 6/13 [02:33<04:07, 35.35s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 317.05it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 676.47it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 543.36it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1518.44it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 18\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.9\n",
- "Moving batch correct size: 18\n",
- "Moving batch error size: 2\n",
- "Subset Error size: 2\n",
- "Subset Correct size: 4\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 0.0\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "Subset loss backward time: 7.857504606246948\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 282.66it/s]\n",
- "Evaluating step(6): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:02<00:00, 2.75it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:03<00:13, 3.26s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 687.22it/s]\n",
- "Evaluating step(6): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 539.26it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:04<00:06, 2.16s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 608.62it/s]\n",
- "Evaluating step(6): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 246.48it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:05<00:03, 1.68s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 417.60it/s]\n",
- "Evaluating step(6): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 422.96it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:07<00:01, 1.58s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 464.91it/s]\n",
- "Evaluating step(6): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 269.93it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:08<00:00, 1.67s/it]\n",
- "Training Step: 34: 54%|ββββββ | 7/13 [02:49<02:55, 29.23s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 104.68it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.42it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 556.85it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 14230.04it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 22\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.9\n",
- "Moving batch correct size: 18\n",
- "Moving batch error size: 2\n",
- "Subset Error size: 2\n",
- "Subset Correct size: 4\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "setting pred name Generator_outputy_pred_3 score to 1.0\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "Subset loss backward time: 6.2225048542022705\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 584.16it/s]\n",
- "Evaluating step(7): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:01<00:00, 4.41it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:10, 2.54s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 943.25it/s]\n",
- "Evaluating step(7): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 367.37it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:03<00:04, 1.65s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 802.76it/s]\n",
- "Evaluating step(7): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 290.57it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:04<00:02, 1.44s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 736.81it/s]\n",
- "Evaluating step(7): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 352.92it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:05<00:01, 1.31s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 596.84it/s]\n",
- "Evaluating step(7): 0.5 across 6 samples, Max potential: 0.5: 100%|ββββββββββ| 6/6 [00:00<00:00, 250.75it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:07<00:00, 1.45s/it]\n",
- "Training Step: 35: 62%|βββββββ | 8/13 [03:04<02:04, 24.82s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.5 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 70.79it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:02<00:00, 1.78it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 388.55it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 2027.46it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 22\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.9\n",
- "Moving batch correct size: 18\n",
- "Moving batch error size: 2\n",
- "Subset Error size: 2\n",
- "Subset Correct size: 4\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "setting pred name Generator_outputy_pred_1 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "Subset loss backward time: 5.618266582489014\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 304.00it/s]\n",
- "Evaluating step(8): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:02<00:00, 2.79it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:03<00:13, 3.44s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly and ensure each item is counted correctly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 128.97it/s]\n",
- "Evaluating step(8): 1.0 across 6 samples, Max potential: 1.0: 100%|ββββββββββ| 6/6 [00:01<00:00, 3.62it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass subset check: 1.0 > 0.6666666666666666\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 20/20 [00:00<00:00, 649.93it/s]\n",
- "Evaluating step(8): 0.95 across 20 samples, Max potential: 0.95: 100%|ββββββββββ| 20/20 [00:02<00:00, 8.93it/s]\n",
- "Proposing: 20%|ββ | 1/5 [00:08<00:35, 8.79s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Pass full check: 0.95 >= 0.9\n",
- "Done with proposals\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2667.62it/s]\n",
- "Evaluating step(35): 0.8511 across 47 samples, Max potential: 0.86: 94%|ββββββββββ| 47/50 [00:00<00:00, 559.52it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Optimizer revert: 0.8333333333333334 <= 0.86\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training Step: 36: 69%|βββββββ | 9/13 [03:21<01:29, 22.39s/it]\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 154.85it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.33it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 610.06it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1798.78it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 22\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.95\n",
- "Moving batch correct size: 19\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "Subset loss backward time: 2.553833246231079\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 228.47it/s]\n",
- "Evaluating step(9): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.44it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:09, 2.47s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 700.57it/s]\n",
- "Evaluating step(9): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 207.56it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:03<00:05, 1.69s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 782.91it/s]\n",
- "Evaluating step(9): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 712.51it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:04<00:02, 1.49s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 269.05it/s]\n",
- "Evaluating step(9): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 266.32it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:06<00:01, 1.40s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 466.64it/s]\n",
- "Evaluating step(9): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 498.14it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:07<00:00, 1.48s/it]\n",
- "Training Step: 37: 77%|ββββββββ | 10/13 [03:33<00:56, 18.97s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 115.54it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.77it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 561.81it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1002.40it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 23\n",
- "Moving batch error size: 1\n",
- "Moving batch acc: 0.95\n",
- "Moving batch correct size: 19\n",
- "Moving batch error size: 1\n",
- "Subset Error size: 1\n",
- "Subset Correct size: 2\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "Subset loss backward time: 2.35148024559021\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 139.22it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 3.95it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:01<00:07, 1.81s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 277.60it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 561.39it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:02<00:04, 1.42s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 736.01it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 168.63it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:03<00:02, 1.24s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 441.77it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 518.09it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:05<00:01, 1.19s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 396.70it/s]\n",
- "Evaluating step(10): 0.6667 across 3 samples, Max potential: 0.6667: 100%|ββββββββββ| 3/3 [00:00<00:00, 199.84it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:06<00:00, 1.27s/it]\n",
- "Training Step: 38: 85%|βββββββββ | 11/13 [03:43<00:32, 16.20s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 138.49it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 6.41it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 610.01it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 10665.74it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Moving batch correct size: 22\n",
- "Moving batch error size: 2\n",
- "Moving batch acc: 0.9\n",
- "Moving batch correct size: 18\n",
- "Moving batch error size: 2\n",
- "Subset Error size: 2\n",
- "Subset Correct size: 4\n",
- "Subset score: 0.6666666666666666\n",
- "Subset batch acc: 0.6666666666666666\n",
- "Subset loss backward...\n",
- "setting pred name Generator_outputy_pred_0 score to 1.0\n",
- "setting pred name Generator_outputy_pred_2 score to 0.0\n",
- "setting pred name Generator_outputy_pred_2 score to 1.0\n",
- "Subset loss backward time: 11.797855138778687\n",
- "Optimizer propose...\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Proposing: 0%| | 0/5 [00:00, ?it/s]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 221.09it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:01<00:00, 4.45it/s]\n",
- "\n",
- "Proposing: 20%|ββ | 1/5 [00:02<00:09, 2.46s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 690.80it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:00<00:00, 309.16it/s]\n",
- "\n",
- "Proposing: 40%|ββββ | 2/5 [00:03<00:04, 1.61s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 488.13it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:00<00:00, 365.81it/s]\n",
- "\n",
- "Proposing: 60%|ββββββ | 3/5 [00:04<00:02, 1.36s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 693.52it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:00<00:00, 272.61it/s]\n",
- "\n",
- "Proposing: 80%|ββββββββ | 4/5 [00:05<00:01, 1.35s/it]\u001b[A"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Pay special attention to quantities mentioned explicitly, including multiples. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=None, requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 6/6 [00:00<00:00, 767.58it/s]\n",
- "Evaluating step(11): 0.6667 across 6 samples, Max potential: 0.6667: 100%|ββββββββββ| 6/6 [00:00<00:00, 719.89it/s]\n",
- "\n",
- "Proposing: 100%|ββββββββββ| 5/5 [00:07<00:00, 1.41s/it]\n",
- "Training Step: 38: 92%|ββββββββββ| 12/13 [04:02<00:20, 20.21s/it]\n",
- "Epoch: 100%|ββββββββββ| 1/1 [04:02<00:00, 242.58s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail subset check, try next proposal: 0.6666666666666666 <= 0.6666666666666666\n",
- "Done with proposals\n",
- "No proposal can improve the subset and full set, go to next step\n",
- "Reached max steps\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " You are the feedback engine in an optimization system.\n",
- " \n",
- " Your role: Provide intelligent and creative feedback for the variable enclosed in tags, based on the objective specified in tags.\n",
- " 1. Focus on the downstream OBJECTIVE without proposing new versions of the variable.\n",
- " 2. Feedback examples: \"Since language models have the X failure mode...\", \"Adding X can fix this error because...\", \"Removing X can improve the objective function because...\", \"Changing X to Y would fix the mistake...\"\n",
- " 3. Consider the variable in the context of its peers if provided.\n",
- " Remember:\n",
- " Be concise, critical, and direct.\n",
- " \n",
- " \n",
- " {{conversation_sec}}\n",
- " \n",
- " {{objective_instruction_sec}}\n",
- " , prompt_variables: ['objective_instruction_sec', 'conversation_sec']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " You are the feedback engine in an optimization system.\n",
- " \n",
- " Your role: Provide intelligent and creative feedback for the variable enclosed in tags, based on the objective specified in tags.\n",
- " 1. Focus on the downstream OBJECTIVE without proposing new versions of the variable.\n",
- " 2. Feedback examples: \"Since language models have the X failure mode...\", \"Adding X can fix this error because...\", \"Removing X can improve the objective function because...\", \"Changing X to Y would fix the mistake...\"\n",
- " 3. Consider the variable in the context of its peers if provided.\n",
- " Remember:\n",
- " Be concise, critical, and direct.\n",
- " \n",
- " \n",
- " {{conversation_sec}}\n",
- " \n",
- " {{objective_instruction_sec}}\n",
- " , prompt_variables: ['objective_instruction_sec', 'conversation_sec']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- "), teacher Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " You are the feedback engine in an optimization system.\n",
- " \n",
- " Your role: Provide intelligent and creative feedback for the variable enclosed in tags, based on the objective specified in tags.\n",
- " 1. Focus on the downstream OBJECTIVE without proposing new versions of the variable.\n",
- " 2. Feedback examples: \"Since language models have the X failure mode...\", \"Adding X can fix this error because...\", \"Removing X can improve the objective function because...\", \"Changing X to Y would fix the mistake...\"\n",
- " 3. Consider the variable in the context of its peers if provided.\n",
- " Remember:\n",
- " Be concise, critical, and direct.\n",
- " \n",
- " \n",
- " {{conversation_sec}}\n",
- " \n",
- " {{objective_instruction_sec}}\n",
- " , prompt_variables: ['objective_instruction_sec', 'conversation_sec']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- ")\n",
- "Teacher generator configured.\n",
- "save to /content/adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n",
- "Starting step: 38\n",
- "trainer_results: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training Step: 39: 0%| | 0/12 [00:00, ?it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 39\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 161.31it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 54e272c5-1360-462e-b773-4c58c61472ee already exists. Updating the trace.\n",
- "Trace with id 0e8910c8-703d-4766-a483-c5691125fd03 already exists. Updating the trace.\n",
- "Trace with id 6c0d3a9a-bb01-4fb3-a68b-1edf66861235 already exists. Updating the trace.\n",
- "Trace with id fe9b883c-4f47-44f7-a388-b03a2fb10413 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 812.53it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 2283.86it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 11023.14it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 294.28it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.11it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 485.47it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 11015.90it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['0e8910c8-703d-4766-a483-c5691125fd03']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Fridge\\n\\n 2. Chair\\n\\n 3. Bed\\n\\n 4. Oven\\n\\n 5. Microwave\\n\\n 6. Car\\n\\n\\n There are 6 objects in total.\\n\\n\\n Answer: 6'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3194.64it/s]\n",
- "Evaluating step(39): 0.6818 across 22 samples, Max potential: 0.86: 44%|βββββ | 22/50 [00:15<00:19, 1.45it/s]\n",
- "Training Step: 40: 17%|ββ | 2/12 [00:17<02:58, 17.85s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.6521739130434783 <= 0.86, revert\n",
- "Training Step: 40\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 697.57it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id daa5804f-1aad-4f01-b26c-6b31c57f065f already exists. Updating the trace.\n",
- "Trace with id 71d549d2-9cc8-46ba-a7f6-d07f69263fd3 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 562.43it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id b538075d-01af-4b76-b835-9005f3044609 already exists. Updating the trace.Trace with id fd34672a-ffd1-498e-a88f-283aa9d4f65d already exists. Updating the trace.\n",
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 577.17it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 9709.04it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 142.07it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.41it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 311.77it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 713.44it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3973.84it/s]\n",
- "Evaluating step(40): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 440.54it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 41: 33%|ββββ | 4/12 [00:22<00:49, 6.19s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 41\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 155.20it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 840d9ed5-8222-45a9-a406-7445feae9733 already exists. Updating the trace.\n",
- "Trace with id 4cd9f4ec-2648-4e85-8e17-3dae1b8558d3 already exists. Updating the trace.\n",
- "Trace with id ac43f3d4-d67d-4912-95d6-0baa09b52d9a already exists. Updating the trace.\n",
- "Trace with id 1eb770ed-ff6f-481e-8c16-b9749a44a1a6 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 1098.13it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 521.96it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 10292.77it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 172.25it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.39it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 587.31it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1397.05it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3444.16it/s]\n",
- "Evaluating step(41): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 318.28it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 42: 42%|βββββ | 5/12 [00:24<00:25, 3.71s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 42\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 268.35it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 4dad0f65-d624-48c2-a795-596c00b0535a already exists. Updating the trace.\n",
- "Trace with id dd9d8748-4926-4bcd-902d-6a4c5cb38267 already exists. Updating the trace.\n",
- "Trace with id 1f682cab-026c-4803-8018-a45d027aa026 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 522.44it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 344.49it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 14755.69it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 93.06it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.03it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 454.94it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 5319.35it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 4718.96it/s]\n",
- "Evaluating step(42): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 404.64it/s]\n",
- "Training Step: 43: 58%|ββββββ | 7/12 [00:27<00:17, 3.51s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n",
- "Training Step: 43\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 261.59it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 46a8994f-fce6-4031-b251-1c8af31d88d2 already exists. Updating the trace.Trace with id 3a9a47c8-a210-43a4-8d24-b9159babb6e4 already exists. Updating the trace.\n",
- "\n",
- "Trace with id 234e39df-1bc4-41df-a515-895cb2614a53 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 428.10it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id de4e75d6-a21b-4004-925d-a9a818bd0f7c already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 296.10it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 11374.38it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 239.89it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.62it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 447.30it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 475.76it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 4960.15it/s]\n",
- "Evaluating step(43): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 464.52it/s]\n",
- "Training Step: 44: 67%|βββββββ | 8/12 [00:30<00:10, 2.51s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n",
- "Training Step: 44\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 237.83it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id aefd17e5-9682-4420-a820-c484a63d6dcd already exists. Updating the trace.\n",
- "Trace with id 2bc992c0-9832-47f1-87c3-9f6e4b18ee99 already exists. Updating the trace.Trace with id 945f82c7-03d9-4f49-8267-be7abac2bce6 already exists. Updating the trace.\n",
- "Trace with id 12a6ff3d-f54d-4d89-b5f0-1aec30e96398 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 1138.91it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 394.77it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 443.51it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 247.66it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.52it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 373.33it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 830.43it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['aefd17e5-9682-4420-a820-c484a63d6dcd']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each vegetable step by step:\\n\\n\\n 1. Carrot: 1\\n\\n 2. Onion: 1\\n\\n 3. Stalk of celery: 1\\n\\n 4. Yams: 3\\n\\n 5. Garlic: 1\\n\\n 6. Head of broccoli: 1\\n\\n 7. Potato: 1\\n\\n\\n Now, let''s add them up:\\n\\n\\n 1 + 1 + 1 + 3 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1197.95it/s]\n",
- "Evaluating step(44): 0.8333 across 42 samples, Max potential: 0.86: 84%|βββββββββ | 42/50 [00:22<00:04, 1.87it/s]\n",
- "Training Step: 45: 75%|ββββββββ | 9/12 [00:57<00:24, 8.31s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.813953488372093 <= 0.86, revert\n",
- "Training Step: 45\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 164.91it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 701be0ee-29e0-42f5-be04-72d2b73e3968 already exists. Updating the trace.\n",
- "Trace with id e2bfbbe0-fb79-4df5-9a7d-50c9085947bc already exists. Updating the trace.\n",
- "Trace with id d4194dd1-739a-4509-8ac8-7c3f89649ee7 already exists. Updating the trace.\n",
- "Trace with id 1b4b3ab0-d20f-4fc2-a09c-4592a227a8e5 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 731.86it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 244.23it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 395.27it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 140.54it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.11it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 448.16it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 658.37it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2621.44it/s]\n",
- "Evaluating step(45): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 306.53it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 46: 92%|ββββββββββ| 11/12 [00:59<00:06, 6.78s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 46\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 256.89it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 82cf82ff-d826-4bb1-847c-9938aeec8ff5 already exists. Updating the trace.\n",
- "Trace with id 5124e2e6-2aac-4dd3-ab63-9277a7b806a7 already exists. Updating the trace.Trace with id a9a202f5-e723-4d24-ae5e-ad1084a52ef8 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 426.47it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id d3f33ded-170a-4b87-9b0b-987d5fb7b817 already exists. Updating the trace.\n",
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 266.65it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 380.40it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 251.95it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 3.75it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 411.12it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 511.05it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['aefd17e5-9682-4420-a820-c484a63d6dcd']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each vegetable step by step:\\n\\n\\n 1. Carrot: 1\\n\\n 2. Onion: 1\\n\\n 3. Stalk of celery: 1\\n\\n 4. Yams: 3\\n\\n 5. Garlic: 1\\n\\n 6. Head of broccoli: 1\\n\\n 7. Potato: 1\\n\\n\\n Now, let''s add them up:\\n\\n\\n 1 + 1 + 1 + 3 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 4016.92it/s]\n",
- "Evaluating step(46): 0.8333 across 42 samples, Max potential: 0.86: 84%|βββββββββ | 42/50 [00:00<00:00, 303.81it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.813953488372093 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 47: 100%|ββββββββββ| 12/12 [01:01<00:00, 4.42s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 47\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 96.23it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 85d63f78-39c0-4753-a9fc-52202df48673 already exists. Updating the trace.Trace with id 74d1bc97-46cd-406d-8c3a-2f999aae1b2f already exists. Updating the trace.\n",
- "\n",
- "Trace with id 60866bed-8020-4610-a39a-a4a730c035db already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 341.47it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 1d3eceeb-ad24-40f6-8752-2f38241172cb already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 167.75it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 846.95it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 136.09it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:04<00:00, 1.03s/it]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 191.47it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 923.91it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2836.52it/s]\n",
- "Evaluating step(47): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 371.59it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 48: : 13it [01:07, 4.63s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 48\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 189.96it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id 96c716a1-e984-4fe3-9ce0-e156ac709edb already exists. Updating the trace.\n",
- "Trace with id 3835ee47-6951-49ec-b285-621fc1085024 already exists. Updating the trace.Trace with id 99607986-e107-46b8-b86b-177b295983c4 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 295.41it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Trace with id d46e538c-832d-4eb5-ba9b-a308f666baba already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 161.24it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1621.93it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 153.47it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.07it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 207.08it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 344.25it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['99607986-e107-46b8-b86b-177b295983c4']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s list and count the vegetables mentioned:\\n\\n\\n 1. Yam\\n\\n 2. Cauliflower\\n\\n 3. Cabbage (two cabbages)\\n\\n 4. Garlic\\n\\n 5. Carrot\\n\\n 6. Broccoli (head of broccoli)\\n\\n 7. Potato\\n\\n 8. Celery (stalk of celery)\\n\\n 9. Lettuce (lettuce head)\\n\\n\\n Now, let''s count each vegetable:\\n\\n\\n 1. Yam: 1\\n\\n 2. Cauliflower: 1\\n\\n 3. Cabbages: 2\\n\\n 4. Garlic: 1\\n\\n 5. Carrot: 1\\n\\n 6. Broccoli: 1\\n\\n 7. Potato: 1\\n\\n 8. Celery: 1\\n\\n 9. Lettuce: 1\\n\\n\\n Adding them up:\\n\\n\\n 1 + 1 + 2 + 1 + 1 + 1 + 1 + 1 + 1 = 10\\n\\n\\n Answer: 10'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 1430.74it/s]\n",
- "Evaluating step(48): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:28<00:07, 1.41it/s]\n",
- "Training Step: 49: : 14it [01:39, 11.59s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n",
- "Training Step: 49\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 122.71it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id ffe67a7b-7b81-4302-b6ed-4b506570274b already exists. Updating the trace.\n",
- "Trace with id 8895d6bd-eab0-48af-ad4b-51f8007258b1 already exists. Updating the trace.\n",
- "Trace with id d71ad721-d21d-42f1-af9b-719ff026406b already exists. Updating the trace.Trace with id e250f80e-334e-4f85-ac1f-df9a2013d578 already exists. Updating the trace.\n",
- "\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:00<00:00, 421.38it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 121.46it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1767.14it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 166.47it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.02it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 206.20it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 983.31it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 3168.14it/s]\n",
- "Evaluating step(49): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 492.44it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 50: : 16it [01:42, 9.33s/it]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Training Step: 50\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 108.30it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Trace with id c42fea48-1b90-4388-92c4-b65b4356a3a2 already exists. Updating the trace.\n",
- "Trace with id 660c5004-35d2-4a6d-9a06-1e0b3f032f21 already exists. Updating the trace.\n",
- "Trace with id 7694df14-3a24-40bd-a3fa-036c2645eca3 already exists. Updating the trace.\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Training: 100%|ββββββββββ| 4/4 [00:03<00:00, 1.04it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 220.83it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1212.75it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 90.57it/s]\n",
- "Training: 100%|ββββββββββ| 4/4 [00:01<00:00, 2.12it/s]\n",
- "\n",
- "Loading Data: 100%|ββββββββββ| 4/4 [00:00<00:00, 208.93it/s]\n",
- "Calculating Loss: 100%|ββββββββββ| 4/4 [00:00<00:00, 1002.82it/s]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "sampled_augmented_demos: ['fd34672a-ffd1-498e-a88f-283aa9d4f65d']\n",
- "New prompts: [PromptData(id='a530c025-f25c-4423-b146-215ff73586f4', name='llm_counter.system_prompt', data=\"You will answer a reasoning question. Carefully count each item and verify your total. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", requires_opt=True), PromptData(id='0b4dc918-1afb-4f03-9193-90ec51a9abab', name='llm_counter.few_shot_demos', data=\"Example: 'Let''s count each item step by step:\\n\\n\\n 1. Microwave: 1\\n\\n 2. Lamp: 1\\n\\n 3. Cars: 4\\n\\n 4. Stove: 1\\n\\n 5. Toaster: 1\\n\\n 6. Bed: 1\\n\\n\\n Now, add them all together:\\n\\n\\n 1 + 1 + 4 + 1 + 1 + 1 = 9\\n\\n\\n Answer: 9'\", requires_opt=True)]\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Loading Data: 100%|ββββββββββ| 50/50 [00:00<00:00, 2261.91it/s]\n",
- "Evaluating step(50): 0.825 across 40 samples, Max potential: 0.86: 80%|ββββββββ | 40/50 [00:00<00:00, 281.78it/s]"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Fail validation: 0.8048780487804879 <= 0.86, revert\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "\n",
- "Training Step: 50: 100%|ββββββββββ| 12/12 [01:49<00:00, 9.15s/it]\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Saved ckpt to /content/adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n",
- "Training time: 352.5873613357544s\n",
- "ckpt_file: /content/adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\n"
- ]
- }
- ],
- "source": [
- "\n",
- "ckpt_path = \"/content/adalflow/ckpt/ObjectCountAdalComponent/constrained_max_steps_12_4e8a1_run_1.json\"\n",
- "\n",
- "train(debug=False, max_steps=12, strategy=\"constrained\",\n",
- " raw_shots=0, bootstrap_shots=1,\n",
- " resume_from_ckpt=ckpt_path,\n",
- " exclude_input_fields_from_bootstrap_demos=True)"
- ]
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "\n",
+ "Loading Data: 100%|ββββββββββ| 3/3 [00:00<00:00, 225.14it/s]\n",
+ "Evaluating step(4): 1.0 across 3 samples, Max potential: 1.0: 100%|ββββββββββ| 3/3 [00:01<00:00, 2.43it/s]\n"
+ ]
},
{
- "cell_type": "markdown",
- "metadata": {
- "id": "m5fZGQqLE78r"
- },
- "source": [
- "I decide to try more, this time, using strategy \"random\". And in the bootstrap demo, there is one shot, but I ensure I also add the \"input\" in the demonstration."
- ]
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Pass subset check: 1.0 > 0.6666666666666666\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "78JAv4ULEn07",
- "outputId": "e87bb360-fc26-4dbd-d163-86ab32c292df"
- },
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "WARNING:adalflow.core.generator:Error copying the prompt_kwargs: 'prompt' is not a valid ParameterType\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-3.5-turbo.db\n",
- "ObjectCountAdalComponent(\n",
- " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
- " (task): ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- " )\n",
- " (loss_fn): EvalFnToTextLoss()\n",
- ")\n",
- "Trainer(\n",
- " (adaltask): ObjectCountAdalComponent(\n",
- " eval_fn: compute_single_item, backward_engine: None, backward_engine_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, teacher_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}, text_optimizer_model_config: {'model_client': OpenAIClient(), 'model_kwargs': {'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}}\n",
- " (task): ObjectCountTaskPipeline(\n",
- " (llm_counter): Generator(\n",
- " model_kwargs={'model': 'gpt-3.5-turbo', 'max_tokens': 2000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': None}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- " )\n",
- " )\n",
- " (loss_fn): EvalFnToTextLoss()\n",
- " )\n",
- ")\n",
- "raw_shots: 0, bootstrap_shots: 1\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "cache_path: /root/.adalflow/cache_OpenAIClient_gpt-4o.db\n",
- "Configuring teacher generator for Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: \n",
- " {{system_prompt}}\n",
- " {# Few shot demos #}\n",
- " {% if few_shot_demos is not none %}\n",
- " Here are some examples:\n",
- " {{few_shot_demos}}\n",
- " {% endif %}\n",
- " \n",
- " \n",
- " {{input_str}}\n",
- " \n",
- " , prompt_kwargs: {'system_prompt': \"You will answer a reasoning question. Think step by step. The last line of your response should be of the following format: 'Answer: $VALUE' where VALUE is a numerical value.\", 'few_shot_demos': 'None'}, prompt_variables: ['input_str', 'few_shot_demos', 'system_prompt']\n",
- " )\n",
- " (model_client): OpenAIClient()\n",
- " (output_processors): ParseIntegerAnswerComponent(fun_name=parse_integer_answer)\n",
- ")\n",
- "Teacher generator set: Generator(\n",
- " model_kwargs={'model': 'gpt-4o', 'max_tokens': 4000, 'temperature': 0.0, 'top_p': 0.99, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}, \n",
- " (prompt): Prompt(\n",
- " template: