Skip to content

Commit

Permalink
feat(abstractions): enforcing silence by default
Browse files Browse the repository at this point in the history
  • Loading branch information
TianyiQ committed Dec 6, 2024
1 parent bb3d5b8 commit 985cdad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os, sys
sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path

import logging
logging.basicConfig(level=logging.ERROR)

from benchmark.framework import JudgeBase, ExamineeBase
from benchmark.dummies import DummyJudge
from challenges.follow import FollowJudge
Expand Down
11 changes: 5 additions & 6 deletions src/abstractions/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ def transform(
"""
out_path = f"{root}/output/datasets/{result_data_name}.json"
if self.data_name == result_data_name or self.data_path == out_path:
warnings.warn(
f"Data name {result_data_name} is the same as the current data name. The old instance will be invalidated."
)
if eval(os.environ.get('LOUD_BACKEND', 'False')):
warnings.warn(
f"Data name {result_data_name} is the same as the current data name. The old instance will be invalidated."
)

return self.copy("temp_transform_artifact").transform(
transformation,
result_data_name,
Expand Down Expand Up @@ -532,9 +534,6 @@ def manage_llama_factory_registration(

print(f"Successfully completed de-registration of data {self.data_name}.")

else:
print("No actions taken.")

return return_val

def set_key_fields(
Expand Down
3 changes: 2 additions & 1 deletion src/path.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os, sys
root = "src".join(os.path.dirname(os.path.abspath(__file__)).split("src")[:-1]).rstrip("/").rstrip("\\")
print(f"Library root directory: {root}")
if eval(os.environ.get('LOUD_BACKEND', 'False')):
print(f"Library root directory: {root}")
8 changes: 5 additions & 3 deletions src/utils/data_utils/rw_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def transformation(dic: Dict) -> Dict:
forced_rewrite=True,
)

print(
f"Truncated dataset {data.data_name} from size {original_size} to {len(list(truncated_data.all_passages()))}."
)
if eval(os.environ.get("LOUD_BACKEND", "False")):
print(
f"Truncated dataset {data.data_name} from size {original_size} to {len(list(truncated_data.all_passages()))}."
)

return truncated_data


Expand Down

0 comments on commit 985cdad

Please sign in to comment.