mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 00:23:25 +00:00
benchmarks: always run (not conditional on changes) (#31409)
This commit is contained in:
parent
49eeb0f3c3
commit
1917dd1ccd
48
.github/workflows/codspeed.yml
vendored
48
.github/workflows/codspeed.yml
vendored
@ -5,10 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
|
||||||
- 'libs/core/**'
|
|
||||||
- 'libs/partners/**'
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -20,31 +16,21 @@ env:
|
|||||||
FIREWORKS_API_KEY: foo
|
FIREWORKS_API_KEY: foo
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare_matrix:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.12"
|
|
||||||
- id: files
|
|
||||||
uses: Ana06/get-changed-files@v2.3.0
|
|
||||||
- id: set-matrix
|
|
||||||
run: |
|
|
||||||
uv venv
|
|
||||||
uv pip install packaging requests
|
|
||||||
uv run .github/scripts/check_diff.py ${{ steps.files.outputs.all }} >> $GITHUB_OUTPUT
|
|
||||||
outputs:
|
|
||||||
codspeed: ${{ steps.set-matrix.outputs.codspeed }}
|
|
||||||
codspeed:
|
codspeed:
|
||||||
name: Run benchmarks
|
name: Run benchmarks
|
||||||
needs: [ prepare_matrix ]
|
|
||||||
if: ${{ needs.prepare_matrix.outputs.codspeed != '[]' }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
job-configs: ${{ fromJson(needs.prepare_matrix.outputs.codspeed) }}
|
include:
|
||||||
|
- working-directory: libs/core
|
||||||
|
mode: walltime
|
||||||
|
- working-directory: libs/partners/openai
|
||||||
|
- working-directory: libs/partners/anthropic
|
||||||
|
- working-directory: libs/partners/deepseek
|
||||||
|
- working-directory: libs/partners/fireworks
|
||||||
|
- working-directory: libs/partners/xai
|
||||||
|
- working-directory: libs/partners/mistralai
|
||||||
|
- working-directory: libs/partners/groq
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -54,26 +40,26 @@ jobs:
|
|||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.job-configs.python-version }}
|
python-version: "3.12"
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.job-configs.python-version }}
|
python-version: "3.12"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: uv sync --group test
|
run: uv sync --group test
|
||||||
working-directory: ${{ matrix.job-configs.working-directory }}
|
working-directory: ${{ matrix.working-directory }}
|
||||||
|
|
||||||
- name: Run benchmarks ${{ matrix.job-configs.working-directory }}
|
- name: Run benchmarks ${{ matrix.working-directory }}
|
||||||
uses: CodSpeedHQ/action@v3
|
uses: CodSpeedHQ/action@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODSPEED_TOKEN }}
|
token: ${{ secrets.CODSPEED_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd ${{ matrix.job-configs.working-directory }}
|
cd ${{ matrix.working-directory }}
|
||||||
if [ "${{ matrix.job-configs.working-directory }}" = "libs/core" ]; then
|
if [ "${{ matrix.working-directory }}" = "libs/core" ]; then
|
||||||
uv run --no-sync pytest ./tests/benchmarks --codspeed
|
uv run --no-sync pytest ./tests/benchmarks --codspeed
|
||||||
else
|
else
|
||||||
uv run --no-sync pytest ./tests/ --codspeed
|
uv run --no-sync pytest ./tests/ --codspeed
|
||||||
fi
|
fi
|
||||||
mode: ${{ matrix.job-configs.working-directory == 'libs/core' && 'walltime' || 'instrumentation' }}
|
mode: ${{ matrix.mode || 'instrumentation' }}
|
||||||
|
|
||||||
|
@ -1012,4 +1012,9 @@ class ChatModelUnitTests(ChatModelTests):
|
|||||||
"""Test initialization time of the chat model. If this test fails, check that
|
"""Test initialization time of the chat model. If this test fails, check that
|
||||||
we are not introducing undue overhead in the model's initialization.
|
we are not introducing undue overhead in the model's initialization.
|
||||||
"""
|
"""
|
||||||
_ = benchmark(self.chat_model_class, **self.chat_model_params)
|
|
||||||
|
def _init_in_loop() -> None:
|
||||||
|
for _ in range(10):
|
||||||
|
self.chat_model_class(**self.chat_model_params)
|
||||||
|
|
||||||
|
benchmark(_init_in_loop)
|
||||||
|
Loading…
Reference in New Issue
Block a user