IlyasMoutawwakil HF staff commited on
Commit
fb987cd
·
1 Parent(s): 81f0c10
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -11,7 +11,7 @@ from config_store import (
11
  )
12
 
13
  import gradio as gr
14
- from huggingface_hub import whoami
15
  from huggingface_hub.errors import GatedRepoError
16
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
17
  from optimum_benchmark.launchers.device_isolation_utils import * # noqa
@@ -66,9 +66,10 @@ def parse_configs(inputs):
66
  for k, v in configs[key].items():
67
  if k in [
68
  "input_shapes",
 
69
  "generate_kwargs",
70
- "call_kwargs",
71
  "numactl_kwargs",
 
72
  ]:
73
  configs[key][k] = eval(v)
74
 
@@ -95,12 +96,20 @@ def run_benchmark(inputs, oauth_token: Optional[gr.OAuthToken]):
95
  if oauth_token is None:
96
  raise gr.Error("Please login to be able to run the benchmark.")
97
 
98
- timestamp = time.strftime("%Y-%m-%d-%H-%M-%S")
99
  user_name = whoami(oauth_token.token)["name"]
100
  repo_id = f"{user_name}/benchmarks"
101
  folder = f"{timestamp}"
102
 
103
- gr.Info(f"📩 Benchmark will be saved under {repo_id} in the folder {folder}")
 
 
 
 
 
 
 
 
104
 
105
  outputs = {backend: "Running..." for backend in BACKENDS}
106
  configs = parse_configs(inputs)
 
11
  )
12
 
13
  import gradio as gr
14
+ from huggingface_hub import whoami, create_repo
15
  from huggingface_hub.errors import GatedRepoError
16
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
17
  from optimum_benchmark.launchers.device_isolation_utils import * # noqa
 
66
  for k, v in configs[key].items():
67
  if k in [
68
  "input_shapes",
69
+ "reshape_kwargs",
70
  "generate_kwargs",
 
71
  "numactl_kwargs",
72
+ "call_kwargs",
73
  ]:
74
  configs[key][k] = eval(v)
75
 
 
96
  if oauth_token is None:
97
  raise gr.Error("Please login to be able to run the benchmark.")
98
 
99
+ timestamp = time.strftime("%Y-%m-%d-%H:%M:%S")
100
  user_name = whoami(oauth_token.token)["name"]
101
  repo_id = f"{user_name}/benchmarks"
102
  folder = f"{timestamp}"
103
 
104
+ try:
105
+ create_repo(
106
+ repo_id=repo_id, repo_type="dataset", token=oauth_token.token, exist_ok=True
107
+ )
108
+ gr.Info(f"📩 Benchmarks will be saved under {repo_id} in the folder {folder}")
109
+ except Exception:
110
+ gr.Info(
111
+ f"❌ Error while creating the repo {repo_id} where benchmarks are to be saved"
112
+ )
113
 
114
  outputs = {backend: "Running..." for backend in BACKENDS}
115
  configs = parse_configs(inputs)