Skip to content

Commit

Permalink
Merge pull request #6 from RomiconEZ/testing_artifacts
Browse files Browse the repository at this point in the history
Updated creation of artifacts dir.
  • Loading branch information
nizamovtimur authored Sep 11, 2024
2 parents 20a5b8d + 256ff0c commit d0cd595
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/llamator/attack_provider/attack_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def instantiate_tests(
A list of instantiated test objects.
"""

csv_report_path = artifacts_path
csv_report_path = None

if artifacts_path is not None:
# Create 'csv_report' directory inside artifacts_path
Expand Down
22 changes: 17 additions & 5 deletions src/llamator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ def start_testing(
if artifacts_path is None:
enable_logging = False
enable_reports = False
artifacts_run_path = None
print("Logging and reports have been disabled.")
else:
# Validate the artifacts path
if not validate_artifacts_path(artifacts_path):
print("Invalid artifacts path.")
return
else:
elif enable_reports is True or enable_logging is True:
# Create a new folder named 'llamato_run_{start_timestamp}' inside artifacts_path
run_folder_name = f"LLAMATOR_run_{start_timestamp}"
run_folder_path = os.path.join(artifacts_path, run_folder_name)
Expand Down Expand Up @@ -124,10 +125,21 @@ def start_testing(
logging.error("One or more custom tests failed validation.")
return

# Running tests with the specified parameters
setup_models_and_tests(
attack_model, tested_model, num_attempts, num_threads, tests, custom_tests, artifacts_run_path
)
if enable_reports:
# Running tests with the specified parameters
setup_models_and_tests(
attack_model,
tested_model,
num_attempts,
num_threads,
tests,
custom_tests,
artifacts_path=artifacts_run_path,
)
else:
setup_models_and_tests(
attack_model, tested_model, num_attempts, num_threads, tests, custom_tests, artifacts_path=None
)

# Thank you message at the end of the program
logging.info(f"Completion of testing")
Expand Down

0 comments on commit d0cd595

Please sign in to comment.