Fix Repository not creating repo anymore

#48
by Wauplin HF staff - opened
Files changed (1) hide show
  1. utils.py +8 -2
utils.py CHANGED
@@ -6,7 +6,7 @@ import jsonlines
6
  import requests
7
  import streamlit as st
8
  from evaluate import load
9
- from huggingface_hub import HfApi, ModelFilter, Repository, dataset_info, list_metrics
10
  from tqdm import tqdm
11
 
12
  AUTOTRAIN_TASK_TO_HUB_TASK = {
@@ -122,12 +122,18 @@ def format_col_mapping(col_mapping: dict) -> dict:
122
 
123
 
124
  def commit_evaluation_log(evaluation_log, hf_access_token=None):
 
 
 
 
 
 
 
125
  logs_repo_url = f"https://huggingface.co/datasets/autoevaluate/{LOGS_REPO}"
126
  logs_repo = Repository(
127
  local_dir=LOGS_REPO,
128
  clone_from=logs_repo_url,
129
  repo_type="dataset",
130
- private=True,
131
  use_auth_token=hf_access_token,
132
  )
133
  logs_repo.git_pull()
 
6
  import requests
7
  import streamlit as st
8
  from evaluate import load
9
+ from huggingface_hub import HfApi, ModelFilter, Repository, dataset_info, list_metrics, create_repo
10
  from tqdm import tqdm
11
 
12
  AUTOTRAIN_TASK_TO_HUB_TASK = {
 
122
 
123
 
124
  def commit_evaluation_log(evaluation_log, hf_access_token=None):
125
+ create_repo(
126
+ repo_id=f"autoevaluate/{LOGS_REPO}",
127
+ repo_type="dataset",
128
+ exists_ok=True,
129
+ private=True,
130
+ token=hf_access_token,
131
+ )
132
  logs_repo_url = f"https://huggingface.co/datasets/autoevaluate/{LOGS_REPO}"
133
  logs_repo = Repository(
134
  local_dir=LOGS_REPO,
135
  clone_from=logs_repo_url,
136
  repo_type="dataset",
 
137
  use_auth_token=hf_access_token,
138
  )
139
  logs_repo.git_pull()