Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1000,27 +1000,27 @@ with ui.navset_card_tab(id="tab"):
|
|
1000 |
selected='compliment'
|
1001 |
)
|
1002 |
def plot_loss_rates(df, param_types, loss_types, model_types):
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
|
1025 |
import matplotlib as mpl
|
1026 |
@render.plot()
|
|
|
1000 |
selected='compliment'
|
1001 |
)
|
1002 |
def plot_loss_rates(df, param_types, loss_types, model_types):
|
1003 |
+
# interplot each column to be same number of points
|
1004 |
+
x = np.linspace(0, 1, 1000)
|
1005 |
+
loss_rates = []
|
1006 |
+
labels = []
|
1007 |
+
#drop the column step
|
1008 |
+
df = df.drop(columns=['Step'])
|
1009 |
+
for param_type in param_types:
|
1010 |
+
for loss_type in loss_types:
|
1011 |
+
for model_type in model_types:
|
1012 |
+
y = df[df['param_type']==param_type && df['loss_type']==loss_type && df['model_type']==model_type]['loss'].dropna().astype('float', errors = 'ignore').dropna().values
|
1013 |
+
f = interp1d(np.linspace(0, 1, len(y)), y)
|
1014 |
+
loss_rates.append(f(x))
|
1015 |
+
labels.append(param_type +'_'+loss_type +'_'+model_type)
|
1016 |
+
fig, ax = plt.subplots()
|
1017 |
+
for i, loss_rate in enumerate(loss_rates):
|
1018 |
+
ax.plot(x, loss_rate, label=labels[i])
|
1019 |
+
ax.legend()
|
1020 |
+
ax.set_title(f'Loss rates for a {type} parameter model across context windows')
|
1021 |
+
ax.set_xlabel('Training steps')
|
1022 |
+
ax.set_ylabel('Loss rate')
|
1023 |
+
return fig
|
1024 |
|
1025 |
import matplotlib as mpl
|
1026 |
@render.plot()
|