nanom commited on
Commit
44f418e
1 Parent(s): b546526

Changed logs dataset target

Browse files
.gitignore CHANGED
@@ -1,3 +1,3 @@
1
  __pycache__/
2
  .env
3
- bias_tool_logs/
 
1
  __pycache__/
2
  .env
3
+ logs_edia_lmodels_english/
app.py CHANGED
@@ -15,7 +15,7 @@ from interfaces.interface_crowsPairs import interface as interface_crowsPairs
15
  # --- Tool config ---
16
  LANGUAGE_MODEL = "bert-base-multilingual-uncased"
17
  LANGUAGE = "english" # [english]
18
- AVAILABLE_LOGS = True # [True | False]
19
 
20
 
21
  # --- Init classes ---
 
15
  # --- Tool config ---
16
  LANGUAGE_MODEL = "bert-base-multilingual-uncased"
17
  LANGUAGE = "english" # [english]
18
+ AVAILABLE_LOGS = True # [True | False]
19
 
20
 
21
  # --- Init classes ---
interfaces/interface_crowsPairs.py CHANGED
@@ -14,7 +14,8 @@ def interface(
14
 
15
  # --- Init logs ---
16
  log_callback = HuggingFaceDatasetSaver(
17
- available_logs=available_logs
 
18
  )
19
 
20
  # --- Init vars ---
@@ -114,7 +115,7 @@ def interface(
114
  save_field = [sent0, sent1, sent2, sent3, sent4, sent5]
115
  log_callback.setup(
116
  components=save_field,
117
- flagging_dir=f"crows_pairs_{lang}"
118
  )
119
 
120
  btn.click(
 
14
 
15
  # --- Init logs ---
16
  log_callback = HuggingFaceDatasetSaver(
17
+ available_logs=available_logs,
18
+ dataset_name=f"logs_edia_lmodels_{lang}"
19
  )
20
 
21
  # --- Init vars ---
 
115
  save_field = [sent0, sent1, sent2, sent3, sent4, sent5]
116
  log_callback.setup(
117
  components=save_field,
118
+ flagging_dir=f"logs_crows_pairs"
119
  )
120
 
121
  btn.click(
interfaces/interface_sesgoEnFrases.py CHANGED
@@ -14,7 +14,8 @@ def interface(
14
 
15
  # --- Init logs ---
16
  log_callback = HuggingFaceDatasetSaver(
17
- available_logs=available_logs
 
18
  )
19
 
20
  # --- Init vars ---
@@ -42,7 +43,8 @@ def interface(
42
  )
43
  sent = gr.Textbox(
44
  label=labels["sent"]["title"],
45
- placeholder=labels["sent"]["placeholder"]
 
46
  )
47
 
48
  gr.Markdown(
@@ -50,7 +52,8 @@ def interface(
50
  )
51
  word_list = gr.Textbox(
52
  label=labels["wordList"]["title"],
53
- placeholder=labels["wordList"]["placeholder"]
 
54
  )
55
 
56
  with gr.Group():
@@ -124,13 +127,13 @@ def interface(
124
  save_field = [sent, word_list]
125
  log_callback.setup(
126
  components=save_field,
127
- flagging_dir=f"sesgo_en_frases_{lang}"
128
  )
129
 
130
  btn.click(
131
  fn=lambda *args: log_callback.flag(
132
  flag_data=args,
133
- flag_option="sesgo_en_frases",
134
  username="vialibre"
135
  ),
136
  inputs=save_field,
 
14
 
15
  # --- Init logs ---
16
  log_callback = HuggingFaceDatasetSaver(
17
+ available_logs=available_logs,
18
+ dataset_name=f"logs_edia_lmodels_{lang}"
19
  )
20
 
21
  # --- Init vars ---
 
43
  )
44
  sent = gr.Textbox(
45
  label=labels["sent"]["title"],
46
+ placeholder=labels["sent"]["placeholder"],
47
+ show_label=False
48
  )
49
 
50
  gr.Markdown(
 
52
  )
53
  word_list = gr.Textbox(
54
  label=labels["wordList"]["title"],
55
+ placeholder=labels["wordList"]["placeholder"],
56
+ show_label=False
57
  )
58
 
59
  with gr.Group():
 
127
  save_field = [sent, word_list]
128
  log_callback.setup(
129
  components=save_field,
130
+ flagging_dir="logs_phrase_bias"
131
  )
132
 
133
  btn.click(
134
  fn=lambda *args: log_callback.flag(
135
  flag_data=args,
136
+ flag_option="phrase_bias",
137
  username="vialibre"
138
  ),
139
  inputs=save_field,
language/english.json CHANGED
@@ -8,11 +8,11 @@
8
  "step2": "2. Enter words of interest (Optional)",
9
  "step3": "3. Enter unwanted words (If item 2 is not completed)",
10
  "sent": {
11
- "title": "",
12
  "placeholder": "Use * to mask the word of interest."
13
  },
14
  "wordList": {
15
- "title": "",
16
  "placeholder": "The words in the list must be comma separated"
17
  },
18
  "bannedWordList": {
 
8
  "step2": "2. Enter words of interest (Optional)",
9
  "step3": "3. Enter unwanted words (If item 2 is not completed)",
10
  "sent": {
11
+ "title": "Sent",
12
  "placeholder": "Use * to mask the word of interest."
13
  },
14
  "wordList": {
15
+ "title": "Words of interest",
16
  "placeholder": "The words in the list must be comma separated"
17
  },
18
  "bannedWordList": {
modules/module_logsManager.py CHANGED
@@ -50,8 +50,8 @@ class HuggingFaceDatasetSaver(FlaggingCallback):
50
 
51
  def __init__(
52
  self,
 
53
  hf_token: str=os.getenv('HF_TOKEN'),
54
- dataset_name: str=os.getenv('DS_LOGS_NAME'),
55
  organization: Optional[str]=os.getenv('ORG_NAME'),
56
  private: bool=True,
57
  available_logs: bool=False
@@ -63,6 +63,8 @@ class HuggingFaceDatasetSaver(FlaggingCallback):
63
  organization: The organization to save the dataset under. The hf_token must provide write access to this organization. If not provided, saved under the name of the user corresponding to the hf_token.
64
  private: Whether the dataset should be private (defaults to False).
65
  """
 
 
66
  self.hf_token = hf_token
67
  self.dataset_name = dataset_name
68
  self.organization_name = organization
 
50
 
51
  def __init__(
52
  self,
53
+ dataset_name: str=None,
54
  hf_token: str=os.getenv('HF_TOKEN'),
 
55
  organization: Optional[str]=os.getenv('ORG_NAME'),
56
  private: bool=True,
57
  available_logs: bool=False
 
63
  organization: The organization to save the dataset under. The hf_token must provide write access to this organization. If not provided, saved under the name of the user corresponding to the hf_token.
64
  private: Whether the dataset should be private (defaults to False).
65
  """
66
+ assert(dataset_name is not None), "Error: Parameter 'dataset_name' cannot be empty!."
67
+
68
  self.hf_token = hf_token
69
  self.dataset_name = dataset_name
70
  self.organization_name = organization