Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upgrade GPU to L40S
Browse files
app.py
CHANGED
|
@@ -282,7 +282,7 @@ def start_training(
|
|
| 282 |
shutil.copy(script_location + "/requirements.autotrain", dataset_folder + "/requirements.txt")
|
| 283 |
# command to run autotrain spacerunner
|
| 284 |
cmd = f"autotrain spacerunner --project-name {slugged_lora_name} --script-path {dataset_folder}"
|
| 285 |
-
cmd += f" --username {profile.username} --token {oauth_token.token} --backend spaces-
|
| 286 |
outcome = subprocess.run(cmd.split())
|
| 287 |
if outcome.returncode == 0:
|
| 288 |
return f"""# Your training has started.
|
|
@@ -311,11 +311,11 @@ def swap_visibilty(profile: Union[gr.OAuthProfile, None]):
|
|
| 311 |
def update_pricing(steps, oauth_token: Union[gr.OAuthToken, None]):
|
| 312 |
if(oauth_token and is_spaces):
|
| 313 |
user = whoami(oauth_token.token)
|
| 314 |
-
seconds_per_iteration =
|
| 315 |
total_seconds = (steps * seconds_per_iteration) + 240
|
| 316 |
-
cost_per_second =
|
| 317 |
cost = round(cost_per_second * total_seconds, 2)
|
| 318 |
-
cost_preview = f'''To train this LoRA, a paid
|
| 319 |
### Estimated to cost <b>< US$ {str(cost)}</b> for {round(int(total_seconds)/60, 2)} minutes with your current train settings <small>({int(steps)} iterations at {seconds_per_iteration}s/it)</small>'''
|
| 320 |
if(user["canPay"]):
|
| 321 |
return gr.update(visible=True), cost_preview, gr.update(visible=False), gr.update(visible=True)
|
|
|
|
| 282 |
shutil.copy(script_location + "/requirements.autotrain", dataset_folder + "/requirements.txt")
|
| 283 |
# command to run autotrain spacerunner
|
| 284 |
cmd = f"autotrain spacerunner --project-name {slugged_lora_name} --script-path {dataset_folder}"
|
| 285 |
+
cmd += f" --username {profile.username} --token {oauth_token.token} --backend spaces-l40sx1"
|
| 286 |
outcome = subprocess.run(cmd.split())
|
| 287 |
if outcome.returncode == 0:
|
| 288 |
return f"""# Your training has started.
|
|
|
|
| 311 |
def update_pricing(steps, oauth_token: Union[gr.OAuthToken, None]):
|
| 312 |
if(oauth_token and is_spaces):
|
| 313 |
user = whoami(oauth_token.token)
|
| 314 |
+
seconds_per_iteration = 2.00
|
| 315 |
total_seconds = (steps * seconds_per_iteration) + 240
|
| 316 |
+
cost_per_second = 1.80/60/60
|
| 317 |
cost = round(cost_per_second * total_seconds, 2)
|
| 318 |
+
cost_preview = f'''To train this LoRA, a paid L40S GPU will be hooked under the hood during training and then removed once finished.
|
| 319 |
### Estimated to cost <b>< US$ {str(cost)}</b> for {round(int(total_seconds)/60, 2)} minutes with your current train settings <small>({int(steps)} iterations at {seconds_per_iteration}s/it)</small>'''
|
| 320 |
if(user["canPay"]):
|
| 321 |
return gr.update(visible=True), cost_preview, gr.update(visible=False), gr.update(visible=True)
|