davidberenstein1957 HF staff commited on
Commit
c0c68e7
1 Parent(s): e36d40b

feat: unify flow for generating system prompt and dataset

Browse files
src/distilabel_dataset_generator/sft.py CHANGED
@@ -290,30 +290,37 @@ More information on distilabel and techniques can be found in the "FAQ" tab. The
290
  value=DEFAULT_SYSTEM_PROMPT_DESCRIPTION,
291
  )
292
 
293
- btn_generate_system_prompt = gr.Button(value="🧪 Generate Sytem Prompt")
 
 
294
 
295
  system_prompt = gr.Textbox(
296
  label="Provide or correct the system prompt",
297
  value=DEFAULT_SYSTEM_PROMPT,
298
  )
299
 
300
- btn_generate_system_prompt.click(
301
- fn=generate_system_prompt,
302
- inputs=[dataset_description],
303
- outputs=[system_prompt],
304
- )
305
-
306
  btn_generate_sample_dataset = gr.Button(
307
  value="🧪 Generate Sample Dataset of 5 rows and a single turn",
308
  )
309
 
310
  table = gr.Dataframe(label="Generated Dataset", wrap=True, value=DEFAULT_DATASET)
311
 
 
 
 
 
 
 
 
 
 
 
312
  btn_generate_sample_dataset.click(
313
  fn=generate_dataset,
314
  inputs=[system_prompt],
315
  outputs=[table],
316
  )
 
317
  btn_login: gr.LoginButton | None = get_login_button()
318
  with gr.Column() as push_to_hub_ui:
319
  with gr.Row(variant="panel"):
 
290
  value=DEFAULT_SYSTEM_PROMPT_DESCRIPTION,
291
  )
292
 
293
+ btn_generate_system_prompt = gr.Button(
294
+ value="🧪 Generate Sytem Prompt and Sample Dataset"
295
+ )
296
 
297
  system_prompt = gr.Textbox(
298
  label="Provide or correct the system prompt",
299
  value=DEFAULT_SYSTEM_PROMPT,
300
  )
301
 
 
 
 
 
 
 
302
  btn_generate_sample_dataset = gr.Button(
303
  value="🧪 Generate Sample Dataset of 5 rows and a single turn",
304
  )
305
 
306
  table = gr.Dataframe(label="Generated Dataset", wrap=True, value=DEFAULT_DATASET)
307
 
308
+ btn_generate_system_prompt.click(
309
+ fn=generate_system_prompt,
310
+ inputs=[dataset_description],
311
+ outputs=[system_prompt],
312
+ ).then(
313
+ fn=generate_dataset,
314
+ inputs=[system_prompt],
315
+ outputs=[table],
316
+ )
317
+
318
  btn_generate_sample_dataset.click(
319
  fn=generate_dataset,
320
  inputs=[system_prompt],
321
  outputs=[table],
322
  )
323
+
324
  btn_login: gr.LoginButton | None = get_login_button()
325
  with gr.Column() as push_to_hub_ui:
326
  with gr.Row(variant="panel"):
src/distilabel_dataset_generator/utils.py CHANGED
@@ -57,7 +57,8 @@ def list_orgs(token: OAuthToken = None):
57
  for entry in data["auth"]["accessToken"]["fineGrained"]["scoped"]
58
  if "repo.write" in entry["permissions"]
59
  ]
60
- return organisations
 
61
  else:
62
  return []
63
 
 
57
  for entry in data["auth"]["accessToken"]["fineGrained"]["scoped"]
58
  if "repo.write" in entry["permissions"]
59
  ]
60
+ organisations.append(data["name"])
61
+ return list(set(organisations))
62
  else:
63
  return []
64