Hjgugugjhuhjggg commited on
Commit
3934084
·
verified ·
1 Parent(s): 812b4cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -98,7 +98,8 @@ def merge_process(yaml_config, hf_token, repo_name, profile_name, logs_queue):
98
  merged_path.mkdir(parents=True, exist_ok=True)
99
  config_path = merged_path / "config.yaml"
100
  config_path.write_text(yaml_config)
101
- runner.log(f"Merge configuration saved in {config_path}")
 
102
 
103
  if not repo_name:
104
  runner.log("No repo name provided. Generating a random one.")
@@ -120,7 +121,7 @@ def merge_process(yaml_config, hf_token, repo_name, profile_name, logs_queue):
120
  tmp_env = os.environ.copy()
121
  tmp_env["HF_HOME"] = f"{tmpdirname}/.cache"
122
  full_cli = cli + f" --lora-merge-cache {tmpdirname}/.lora_cache"
123
- runner.run_command(full_cli.split(), cwd=merged_path, env=tmp_env) # Removed yield from
124
 
125
  if runner.exit_code != 0:
126
  runner.log("Merge failed. Deleting repo as no model is uploaded.", level="ERROR")
@@ -128,8 +129,9 @@ def merge_process(yaml_config, hf_token, repo_name, profile_name, logs_queue):
128
  return
129
 
130
  runner.log("Model merged successfully. Uploading to HF.")
131
- runner.run_python(api.upload_folder, repo_id=repo_url.repo_id, folder_path=merged_path / "merge") # Removed yield from
132
- runner.log(f"Model successfully uploaded to HF: {repo_url.repo_id}")
 
133
 
134
 
135
  def merge(yaml_config, hf_token, repo_name, profile_name):
@@ -146,7 +148,6 @@ def merge(yaml_config, hf_token, repo_name, profile_name):
146
  if logs_queue:
147
  yield logs_queue
148
 
149
-
150
  with gr.Blocks() as demo:
151
  gr.Markdown(MARKDOWN_DESCRIPTION)
152
 
@@ -164,8 +165,7 @@ with gr.Blocks() as demo:
164
 
165
  button.click(fn=merge, inputs=[config, token, repo_name, profile_name], outputs=[logs])
166
 
167
-
168
- @spaces.GPU
169
  def launch():
170
  demo.launch(share=True)
171
 
 
98
  merged_path.mkdir(parents=True, exist_ok=True)
99
  config_path = merged_path / "config.yaml"
100
  config_path.write_text(yaml_config)
101
+ current_time = time.strftime("%Y-%m-%d %H:%M:%S")
102
+ runner.log(f"[{current_time}] Merge configuration saved in {config_path}")
103
 
104
  if not repo_name:
105
  runner.log("No repo name provided. Generating a random one.")
 
121
  tmp_env = os.environ.copy()
122
  tmp_env["HF_HOME"] = f"{tmpdirname}/.cache"
123
  full_cli = cli + f" --lora-merge-cache {tmpdirname}/.lora_cache"
124
+ runner.run_command(full_cli.split(), cwd=merged_path, env=tmp_env)
125
 
126
  if runner.exit_code != 0:
127
  runner.log("Merge failed. Deleting repo as no model is uploaded.", level="ERROR")
 
129
  return
130
 
131
  runner.log("Model merged successfully. Uploading to HF.")
132
+ runner.run_python(api.upload_folder, repo_id=repo_url.repo_id, folder_path=merged_path / "merge")
133
+ current_time = time.strftime("%Y-%m-%d %H:%M:%S")
134
+ runner.log(f"[{current_time}] Model successfully uploaded to HF: {repo_url.repo_id}")
135
 
136
 
137
  def merge(yaml_config, hf_token, repo_name, profile_name):
 
148
  if logs_queue:
149
  yield logs_queue
150
 
 
151
  with gr.Blocks() as demo:
152
  gr.Markdown(MARKDOWN_DESCRIPTION)
153
 
 
165
 
166
  button.click(fn=merge, inputs=[config, token, repo_name, profile_name], outputs=[logs])
167
 
168
+ @spaces.GPU(enable_queue=True, duration=0)
 
169
  def launch():
170
  demo.launch(share=True)
171