Skip to content

Commit

Permalink
Release all temlates
Browse files Browse the repository at this point in the history
  • Loading branch information
blythed committed Nov 11, 2024
1 parent 81e41b3 commit e862aa0
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
templates=("${!template_set[@]}")
# Generate a single-line JSON
matrix_json=$(printf '%s' "${templates[@]}" | jq -R -s 'if . == "" then {template: []} else {template: (./"\n" | map(select(. != "")))} end' | jq -c .)
matrix_json=$(printf '%s\n' "${templates[@]}" | jq -R -s 'if . == "" then {template: []} else {template: (./"\n" | map(select(. != "")))} end' | jq -c .)
echo "matrix_json=$matrix_json"
echo "Changed templates: ${templates[*]}"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

**Before you create a Pull Request, remember to update the Changelog with your changes.**

## Changes Since Last Release
## Changes Since Last Release

#### Changed defaults / behaviours

Expand Down
33 changes: 26 additions & 7 deletions superduper/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,38 @@

PARENT = Path(__file__).resolve().parent

BASE_URL = 'https://superduper-public-templates.s3.us-east-2.amazonaws.com'

VERSIONS = {
'llm_finetuning': '0.4.0',
'multimodal_image_search': '0.4.0',
'multimodal_video_search': '0.4.0',
'pdf_rag': '0.4.0',
'rag': '0.4.0',
'simple_rag': '0.4.0',
'transfer_learning': '0.4.0',
}


TEMPLATES = {k: BASE_URL + f'/{k}-{VERSIONS[k]}.zip' for k in VERSIONS}


def ls():
"""List all available templates."""
return [
x.split('.')[0]
for x in os.listdir(PARENT)
if not x.startswith('.') and not x.startswith('__')
]
return TEMPLATES


def __getattr__(name: str):
t = Template.read(str(PARENT / f"{name}"))
requirements_path = str(PARENT / f"{name}" / "requirements.txt")
assert name in TEMPLATES
file = TEMPLATES[name].split('/')[-1]
if not os.path.exists(f'/tmp/{file}'):
import subprocess

subprocess.run(['curl', '-O', '-k', TEMPLATES[name]])
subprocess.run(['mv', file, f'/tmp/{file}'])
subprocess.run(['unzip', f'/tmp/{file}', '-d', f'/tmp/{file[:-4]}'])
t = Template.read(f'/tmp/{file[:-4]}')
requirements_path = f'{file[:-4]}/requirements.txt'
if os.path.exists(requirements_path):
with open(requirements_path, 'r') as f:
t.requirements = [x.strip() for x in f.read().split('\n') if x]
Expand Down
2 changes: 1 addition & 1 deletion templates/llm_finetuning/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.dev
0.4.0
2 changes: 1 addition & 1 deletion templates/multimodal_image_search/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.dev
0.4.0
2 changes: 1 addition & 1 deletion templates/multimodal_video_search/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.dev
0.4.0
2 changes: 1 addition & 1 deletion templates/pdf_rag/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.dev
0.4.0
2 changes: 1 addition & 1 deletion templates/rag/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.dev
0.4.0
2 changes: 1 addition & 1 deletion templates/transfer_learning/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0.dev
0.4.0

0 comments on commit e862aa0

Please sign in to comment.