Add CrabNetSurrogateModel class and example parameterization to app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,38 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
def greet(name):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from surrogate import CrabNetSurrogateModel
|
| 3 |
+
|
| 4 |
+
model = CrabNetSurrogateModel()
|
| 5 |
+
|
| 6 |
+
example_parameterization = parameterization = {
|
| 7 |
+
"N": 3,
|
| 8 |
+
"alpha": 0.5,
|
| 9 |
+
"d_model": 512,
|
| 10 |
+
"dim_feedforward": 2048,
|
| 11 |
+
"dropout": 0.1,
|
| 12 |
+
"emb_scaler": 1.0,
|
| 13 |
+
"epochs_step": 10,
|
| 14 |
+
"eps": 0.000001,
|
| 15 |
+
"fudge": 0.02,
|
| 16 |
+
"heads": 4,
|
| 17 |
+
"k": 6,
|
| 18 |
+
"lr": 0.001,
|
| 19 |
+
"pe_resolution": 5000,
|
| 20 |
+
"ple_resolution": 5000,
|
| 21 |
+
"pos_scaler": 1.0,
|
| 22 |
+
"weight_decay": 0,
|
| 23 |
+
"batch_size": 32,
|
| 24 |
+
"out_hidden4": 128,
|
| 25 |
+
"betas2": 0.9,
|
| 26 |
+
"betas1": 0.999,
|
| 27 |
+
"losscurve": False,
|
| 28 |
+
"learningcurve": False,
|
| 29 |
+
"bias": False,
|
| 30 |
+
"criterion": "RobustL1",
|
| 31 |
+
"elem_prop": "mat2vec",
|
| 32 |
+
"train_frac": 0.5,
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
model.surrogate_evaluate(example_parameterization)
|
| 36 |
|
| 37 |
|
| 38 |
def greet(name):
|