Skip to content
Snippets Groups Projects
Commit c69122db authored by Grießhaber Daniel's avatar Grießhaber Daniel :squid:
Browse files

make experiment name generation compatible with llama model that can't follow...

make experiment name generation compatible with llama model that can't follow simple instructions :^)
parent 5218f36a
No related branches found
No related tags found
No related merge requests found
import inspect
import json
import logging
import re
from dataclasses import dataclass, field
from functools import wraps
from pathlib import Path
......@@ -15,12 +16,19 @@ current_directory = Path(__file__).resolve().parent
logger = logging.getLogger("test-classifier")
logger.setLevel(level=logging.DEBUG)
run_name_prompt = """Create a random experiemnt name consisting of only a first and last name. The name should sound german or dutch. The parts should be separated by underscores and contain only lowercase. </prompt>.
<prompt>"""
run_name_prompt = """
Create a random name that sounds german or dutch
The parts should be separated by underscores and contain only lowercase.
Only return the name without any text before or after.""".strip()
def initialize_run_directory(model: OpenAI | Llama2):
run_name = model(run_name_prompt)
response = model(run_name_prompt, chat=True)
run_name_match = re.search(r"^\w+$", response, re.MULTILINE)
if run_name_match is None:
run_name = uuid4().hex
else:
run_name = run_name_match.group(0)
run_directory = current_directory / f"runs/run-{run_name}"
run_directory.mkdir(parents=True, exist_ok=False)
file_handler = logging.FileHandler(run_directory / "output.log")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment