disabled wandb
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import torch.optim as optim
|
|
| 9 |
import torch.nn.functional as F
|
| 10 |
import torch.backends.cudnn as cudnn
|
| 11 |
import gradio as gr
|
| 12 |
-
import wandb
|
| 13 |
import math
|
| 14 |
import numpy as np
|
| 15 |
import matplotlib.pyplot as plt
|
|
@@ -74,7 +74,7 @@ def class_names(class_num, class_list): # converts the raw number label to text
|
|
| 74 |
|
| 75 |
### MAIN FUNCTION
|
| 76 |
best_acc = 0
|
| 77 |
-
def main(drop_type, epochs_sldr, train_sldr, test_sldr, learning_rate, optimizer, sigma_sldr, adv_attack,
|
| 78 |
|
| 79 |
## Input protection
|
| 80 |
if not drop_type:
|
|
@@ -104,9 +104,7 @@ def main(drop_type, epochs_sldr, train_sldr, test_sldr, learning_rate, optimizer
|
|
| 104 |
attack = str(adv_attack)
|
| 105 |
scheduler_choose = str(scheduler)
|
| 106 |
|
| 107 |
-
#
|
| 108 |
-
wandb.init(entity=username, project="model-training")
|
| 109 |
-
wandb.login(key=["a10127d2a41d4e05f8e7a1d3e69d3f719f4657b5"])
|
| 110 |
|
| 111 |
parser = argparse.ArgumentParser(description='PyTorch CIFAR10 Training')
|
| 112 |
parser.add_argument('--lr', default=0.1, type=float, help='learning rate')
|
|
@@ -505,7 +503,6 @@ with gr.Blocks(css=".caption-label {display:none}") as functionApp:
|
|
| 505 |
gr.Markdown("## Parameters")
|
| 506 |
with gr.Row():
|
| 507 |
inp = gr.Dropdown(choices=names, label="Training Model", value="ResNet18", info="Choose one of 13 common models provided in the dropdown to use for training.")
|
| 508 |
-
username = gr.Textbox(label="Weights and Biases", info="Enter your username or team name from the Weights and Biases API.")
|
| 509 |
epochs_sldr = gr.Slider(label="Number of Epochs", minimum=1, maximum=100, step=1, value=1, info="How many times the model will see the entire dataset during trianing.")
|
| 510 |
with gr.Column():
|
| 511 |
setting_radio = gr.Radio(["Basic", "Advanced"], label="Settings", value="Basic")
|
|
@@ -539,7 +536,7 @@ with gr.Blocks(css=".caption-label {display:none}") as functionApp:
|
|
| 539 |
use_attacks.change(fn=attacks, inputs=use_attacks, outputs=[attack_method, use_sigma, adv_attack])
|
| 540 |
use_sigma.change(fn=gaussian, inputs=use_sigma, outputs=[sigma_sldr, gaussian_pics])
|
| 541 |
adv_attack.change(fn=adversarial, inputs=adv_attack, outputs=attack_pics)
|
| 542 |
-
btn.click(fn=main, inputs=[inp, epochs_sldr, train_sldr, test_sldr, learning_rate_sldr, optimizer, sigma_sldr, adv_attack,
|
| 543 |
|
| 544 |
## Documentation app (implemented as second tab)
|
| 545 |
|
|
|
|
| 9 |
import torch.nn.functional as F
|
| 10 |
import torch.backends.cudnn as cudnn
|
| 11 |
import gradio as gr
|
| 12 |
+
#import wandb
|
| 13 |
import math
|
| 14 |
import numpy as np
|
| 15 |
import matplotlib.pyplot as plt
|
|
|
|
| 74 |
|
| 75 |
### MAIN FUNCTION
|
| 76 |
best_acc = 0
|
| 77 |
+
def main(drop_type, epochs_sldr, train_sldr, test_sldr, learning_rate, optimizer, sigma_sldr, adv_attack, scheduler):
|
| 78 |
|
| 79 |
## Input protection
|
| 80 |
if not drop_type:
|
|
|
|
| 104 |
attack = str(adv_attack)
|
| 105 |
scheduler_choose = str(scheduler)
|
| 106 |
|
| 107 |
+
#wandb.init(entity=username, project="model-training")
|
|
|
|
|
|
|
| 108 |
|
| 109 |
parser = argparse.ArgumentParser(description='PyTorch CIFAR10 Training')
|
| 110 |
parser.add_argument('--lr', default=0.1, type=float, help='learning rate')
|
|
|
|
| 503 |
gr.Markdown("## Parameters")
|
| 504 |
with gr.Row():
|
| 505 |
inp = gr.Dropdown(choices=names, label="Training Model", value="ResNet18", info="Choose one of 13 common models provided in the dropdown to use for training.")
|
|
|
|
| 506 |
epochs_sldr = gr.Slider(label="Number of Epochs", minimum=1, maximum=100, step=1, value=1, info="How many times the model will see the entire dataset during trianing.")
|
| 507 |
with gr.Column():
|
| 508 |
setting_radio = gr.Radio(["Basic", "Advanced"], label="Settings", value="Basic")
|
|
|
|
| 536 |
use_attacks.change(fn=attacks, inputs=use_attacks, outputs=[attack_method, use_sigma, adv_attack])
|
| 537 |
use_sigma.change(fn=gaussian, inputs=use_sigma, outputs=[sigma_sldr, gaussian_pics])
|
| 538 |
adv_attack.change(fn=adversarial, inputs=adv_attack, outputs=attack_pics)
|
| 539 |
+
btn.click(fn=main, inputs=[inp, epochs_sldr, train_sldr, test_sldr, learning_rate_sldr, optimizer, sigma_sldr, adv_attack, scheduler], outputs=[accuracy, pics, allpics, gaussian_pics, attack_pics])
|
| 540 |
|
| 541 |
## Documentation app (implemented as second tab)
|
| 542 |
|