Skip to content

Commit eb20e60

Browse files
timo282mo374z
andauthored
Feature/workflows (#8)
* chore: add codeowners file * chore: add python poetry action and docs workflow * chore: update pre-commit file * chore: update docs * chore: update logo * chore: add cicd pipeline for automated deployment * chore: update poetry version * chore: fix action versioning * chore: add gitattributes to ignore line count in jupyter notebooks * chore: add and update docstrings * chore: fix end of files * chore: update action versions * Update README.md --------- Co-authored-by: mo374z <schlager.mo@t-online.de>
1 parent 9982638 commit eb20e60

File tree

114 files changed

+1283
-19966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1283
-19966
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[flake8]
22
max-line-length = 120
3+
ignore = F401, W503

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ipynb linguist-documentation

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* @finitearth
2+
* @timo282
3+
* @mo374z
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Setup-Python-Poetry
2+
description: 'Setup Python and Poetry'
3+
4+
inputs:
5+
python-version:
6+
description: 'Python version to use'
7+
required: true
8+
default: '3.11'
9+
poetry-version:
10+
description: 'Poetry version to use'
11+
required: true
12+
default: 'latest'
13+
groups:
14+
required: false
15+
default: 'main'
16+
type: string
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: Setup Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ inputs.python-version }}
25+
- name: Setup Poetry
26+
uses: snok/install-poetry@v1.4.1
27+
with:
28+
python-version: ${{ inputs.python-version }}
29+
virtualenvs-in-project: true
30+
virtualenvs-create: true
31+
- uses: actions/cache@v3
32+
id: cached-poetry-dependencies
33+
with:
34+
path: .venv
35+
key: ${{ runner.os }}-poetry-${{ inputs.poetry-version }}-${{ hashFiles('**/poetry.lock') }}
36+
- name: Install dependencies
37+
run: poetry install --no-interaction --no-root --only ${{ inputs.groups }}
38+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
39+
shell: bash

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
types: [opened, synchronize]
9+
branches:
10+
- dev
11+
workflow_call:
12+
workflow_dispatch:
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout
19+
uses: actions/checkout@v3
20+
- name: Set up Python and Poetry
21+
uses: ./.github/actions/python-poetry
22+
with:
23+
groups: dev
24+
- name: Run pre-commit
25+
uses: pre-commit/action@v3.0.1
26+
# - name: Run tests
27+
# run: poetry run python -m pytest
28+
29+
build:
30+
runs-on: ubuntu-latest
31+
needs: test
32+
33+
steps:
34+
- name: checkout
35+
uses: actions/checkout@v3
36+
37+
- name: Set up Python and Poetry
38+
uses: ./.github/actions/python-poetry
39+
40+
- name: Build wheel
41+
run: poetry build --format wheel
42+
43+
- name: Upload wheel
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ github.event.repository.name }}
47+
path: dist/

.github/workflows/cicd.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: CICD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize]
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
name: Run Tests, Pre-Commits, and Build Python package
16+
uses: ./.github/workflows/ci.yml
17+
18+
check-version:
19+
needs: build
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
outputs:
24+
version: ${{ steps.get_version.outputs.VERSION }}
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Set up Python and Poetry
29+
uses: ./.github/actions/python-poetry
30+
with:
31+
cache: true
32+
33+
- name: Get version from pyproject.toml
34+
id: get_version
35+
run: |
36+
echo ::set-output name=VERSION::$(poetry version -s)
37+
38+
- name: Get latest release version
39+
id: get_latest_release
40+
run: |
41+
latest_release=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
42+
echo ::set-output name=LATEST_VERSION::${latest_release#v}
43+
44+
- name: Compare versions
45+
run: |
46+
current_version="${{ steps.get_version.outputs.VERSION }}"
47+
latest_version="${{ steps.get_latest_release.outputs.LATEST_VERSION }}"
48+
if [ "$(printf '%s\n' "$latest_version" "$current_version" | sort -V | tail -n1)" != "$current_version" ]; then
49+
echo "Error: Current version ($current_version) is not higher than the latest release ($latest_version)"
50+
exit 1
51+
fi
52+
53+
create-release:
54+
needs: check-version
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: write
58+
id-token: write
59+
steps:
60+
- uses: actions/checkout@v3
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Create and push tag
65+
run: |
66+
git config --local user.email "action@github.com"
67+
git config --local user.name "GitHub Action"
68+
git tag -a v${{ needs.check-version.outputs.version }} -m "Release v${{ needs.check-version.outputs.version }}"
69+
git push origin v${{ needs.check-version.outputs.version }}
70+
71+
- name: Create GitHub Release
72+
uses: actions/create-release@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
tag_name: v${{ needs.check-version.outputs.version }}
77+
release_name: Release v${{ needs.check-version.outputs.version }}
78+
draft: false
79+
prerelease: false
80+
81+
publish-to-pypi:
82+
needs: [build, check-version, create-release]
83+
name: Publish Python package to PyPI
84+
runs-on: ubuntu-latest
85+
permissions:
86+
contents: read
87+
steps:
88+
- uses: actions/checkout@v3
89+
90+
- name: Set up Python and Poetry
91+
uses: ./.github/actions/python-poetry
92+
with:
93+
cache: true # Enable caching if your custom action supports it
94+
95+
- name: Download wheel
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: ${{ github.event.repository.name }}
99+
path: dist/
100+
101+
- name: Publish to PyPI
102+
env:
103+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
104+
run: |
105+
poetry config pypi-token.pypi $PYPI_TOKEN
106+
poetry publish

.github/workflows/docs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-deploy:
13+
concurrency: ci-${{ github.ref }}
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Setup python and poetry
21+
uses: ./.github/actions/python-poetry
22+
with:
23+
groups: "docs"
24+
25+
- name: Deploy docs
26+
run: |
27+
poetry run mkdocs gh-deploy --force

.pre-commit-config.yaml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
1+
fail_fast: true
12
repos:
3+
- repo: https://github.com/gitleaks/gitleaks
4+
rev: v8.18.2
5+
hooks:
6+
- id: gitleaks
27
- repo: https://github.com/psf/black
3-
rev: 23.3.0 # Use the latest version
8+
rev: 23.7.0
49
hooks:
510
- id: black
6-
11+
- id: black-jupyter
712
- repo: https://github.com/pycqa/flake8
8-
rev: 6.0.0 # Use the latest version
13+
rev: 6.0.0
914
hooks:
1015
- id: flake8
11-
12-
- repo: https://github.com/pre-commit/mirrors-isort
13-
rev: v5.10.1 # Use the latest version
16+
- repo: https://github.com/pycqa/isort
17+
rev: 5.12.0
1418
hooks:
1519
- id: isort
20+
- repo: https://github.com/pycqa/pydocstyle
21+
rev: 6.3.0
22+
hooks:
23+
- id: pydocstyle
24+
- repo: https://github.com/python-poetry/poetry
25+
rev: "1.6.0"
26+
hooks:
27+
- id: poetry-check
28+
- repo: https://github.com/pre-commit/pre-commit-hooks
29+
rev: v4.4.0
30+
hooks:
31+
- id: trailing-whitespace
32+
- id: end-of-file-fixer
33+
- id: mixed-line-ending
34+
- id: check-yaml
35+
- id: check-added-large-files
36+
- id: check-merge-conflict
37+
- id: check-builtin-literals
38+
- id: check-json
39+
- id: check-toml
40+
- id: check-xml
41+
- id: debug-statements
42+
- id: detect-private-key
43+
- repo: https://github.com/compilerla/conventional-pre-commit
44+
rev: v3.4.0
45+
hooks:
46+
- id: conventional-pre-commit
47+
stages: [commit-msg]
48+
args: []

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
![promptolution](https://github.com/user-attachments/assets/84c050bd-61a1-4f2e-bc4e-874d9b4a69af)
12
# Promptolution
2-
33
Promptolution is a library that provides a modular and extensible framework for implementing prompt tuning experiments. It offers a user-friendly interface to assemble the core components for various prompt optimization tasks.
44

55
In addition, this repository contains our experiments for the paper "Towards Cost-Effective Prompt Tuning: Evaluating the Effects of Model Size, Model Family and Task Descriptions in EvoPrompt".

configs/experiment_eval.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ subsample_seed = 42
1212
n_samples = 200
1313

1414
[downstream_llm]
15-
name = meta-llama/Meta-Llama-3-70B-Instruct
15+
name = meta-llama/Meta-Llama-3-70B-Instruct

0 commit comments

Comments
 (0)