Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
evoprompt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grießhaber Daniel
evoprompt
Commits
300ba08e
Commit
300ba08e
authored
1 year ago
by
Max Kimmich
Browse files
Options
Downloads
Patches
Plain Diff
Create unique run names
parent
0aff2b5c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils.py
+5
-3
5 additions, 3 deletions
utils.py
with
5 additions
and
3 deletions
utils.py
+
5
−
3
View file @
300ba08e
import
inspect
import
json
import
logging
import
os
import
re
from
functools
import
wraps
from
pathlib
import
Path
...
...
@@ -32,17 +33,18 @@ 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
()
RUNS_DIR
=
current_directory
/
"
runs
"
def
initialize_run_directory
(
model
:
OpenAI
|
Llama2
):
response
,
usage
=
model
(
None
,
run_name_prompt
,
chat
=
True
)
model
.
usage
-=
usage
run_name_match
=
re
.
search
(
r
"
^\w+$
"
,
response
,
re
.
MULTILINE
)
if
run_name_match
is
None
:
existing_dirs
=
os
.
listdir
(
RUNS_DIR
)
if
run_name_match
is
None
or
run_name_match
.
group
(
0
)
in
existing_dirs
:
run_name
=
uuid4
().
hex
else
:
run_name
=
run_name_match
.
group
(
0
)
run_directory
=
current_directory
/
f
"
runs/
{
run_name
}
"
# TODO what if name exists?
run_directory
=
RUNS_DIR
/
run_name
run_directory
.
mkdir
(
parents
=
True
,
exist_ok
=
False
)
# create file handler and set level to debug
file_handler
=
logging
.
FileHandler
(
run_directory
/
"
output.log
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment