create parameter directories if not existent
This commit is contained in:
parent
621c9291ee
commit
92f2acb272
1 changed files with 5 additions and 0 deletions
5
train.py
5
train.py
|
|
@ -1,6 +1,7 @@
|
||||||
import mlx.core as mx
|
import mlx.core as mx
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import math
|
import math
|
||||||
|
import os
|
||||||
# Functions shared by both the training and the testing scripts.
|
# Functions shared by both the training and the testing scripts.
|
||||||
from common import *
|
from common import *
|
||||||
|
|
||||||
|
|
@ -186,6 +187,10 @@ for epoch in range(EPOCHS):
|
||||||
LEARNING_RATE *= 0.99
|
LEARNING_RATE *= 0.99
|
||||||
|
|
||||||
print("\nTraining complete.")
|
print("\nTraining complete.")
|
||||||
|
if not os.path.exists("weights"):
|
||||||
|
os.makedirs("weights")
|
||||||
|
if not os.path.exists("biases"):
|
||||||
|
os.makedirs("biases")
|
||||||
np.savetxt("weights/weights1.txt", np.array(W1))
|
np.savetxt("weights/weights1.txt", np.array(W1))
|
||||||
np.savetxt("biases/biases1.txt", np.array(b1))
|
np.savetxt("biases/biases1.txt", np.array(b1))
|
||||||
for i in range(HIDDEN_LAYERS):
|
for i in range(HIDDEN_LAYERS):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue