lewtun HF staff commited on
Commit
74c1d10
1 Parent(s): 55958a6

Add dataset config to AutoTrain project name

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. utils.py +3 -3
app.py CHANGED
@@ -525,7 +525,7 @@ with st.form(key="form"):
525
  if len(selected_models) > 0:
526
  project_payload = {
527
  "username": AUTOTRAIN_USERNAME,
528
- "proj_name": create_autotrain_project_name(selected_dataset),
529
  "task": TASK_TO_ID[selected_task],
530
  "config": {
531
  "language": AUTOTRAIN_TASK_TO_LANG[selected_task]
 
525
  if len(selected_models) > 0:
526
  project_payload = {
527
  "username": AUTOTRAIN_USERNAME,
528
+ "proj_name": create_autotrain_project_name(selected_dataset, selected_config),
529
  "task": TASK_TO_ID[selected_task],
530
  "config": {
531
  "language": AUTOTRAIN_TASK_TO_LANG[selected_task]
utils.py CHANGED
@@ -191,13 +191,13 @@ def get_dataset_card_url(dataset_id: str) -> str:
191
  return f"https://github.com/huggingface/datasets/edit/master/datasets/{dataset_id}/README.md"
192
 
193
 
194
- def create_autotrain_project_name(dataset_id: str) -> str:
195
  """Creates an AutoTrain project name for the given dataset ID."""
196
  # Project names cannot have "/", so we need to format community datasets accordingly
197
  dataset_id_formatted = dataset_id.replace("/", "__")
198
  # Project names need to be unique, so we append a random string to guarantee this
199
- project_id = str(uuid.uuid4())[:8]
200
- return f"eval-project-{dataset_id_formatted}-{project_id}"
201
 
202
 
203
  def get_config_metadata(config: str, metadata: List[Dict] = None) -> Union[Dict, None]:
 
191
  return f"https://github.com/huggingface/datasets/edit/master/datasets/{dataset_id}/README.md"
192
 
193
 
194
+ def create_autotrain_project_name(dataset_id: str, dataset_config: str) -> str:
195
  """Creates an AutoTrain project name for the given dataset ID."""
196
  # Project names cannot have "/", so we need to format community datasets accordingly
197
  dataset_id_formatted = dataset_id.replace("/", "__")
198
  # Project names need to be unique, so we append a random string to guarantee this
199
+ project_id = str(uuid.uuid4())[:6]
200
+ return f"eval-{dataset_id_formatted}-{dataset_config}-{project_id}"
201
 
202
 
203
  def get_config_metadata(config: str, metadata: List[Dict] = None) -> Union[Dict, None]: