This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
44 lines (40 loc) · 1.5 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# todo: dynamic optimizers
# todo: DataBase shaping using self.SHAPE
# todo: auto hyperparameter tuning: Grid search, Population-based natural selection
# todo: auto train stop, inf train
# todo: database save inputs, targets, labels separately
# todo: string hyperparams
# todo: look into "NamedTuple"
# fixme: in DunderSaveLoad for __dict__ saves save only req stuff, maybe by subtracting the vars of base __dict__
import pickle
import dill
from src import *
from DataSets import dataSet
from Models import model
db = DataBase.load(dataSet.TrainSets.EmnistBalanced, normalizeInp=1, reshapeInp=(-1, 1),
name='TrainSets.EmnistBalanced')
db2 = DataBase.load(dataSet.TestSets.EmnistBalanced, normalizeInp=1, reshapeInp=(-1, 1),
name='TestSets.EmnistBalanced')
# db2 = False
dense_nn = Dense.NN(shape=Dense.Shape(db.inpShape[0], *(392, 196), db.tarShape[0]),
initializers=None,
activators=None,
lossFunction=None)
dense_nn.train(epochs=1,
batchSize=256,
trainDataBase=db,
optimizers=None,
profile=False,
test=db2)
# # print(dense_nn)
coo = dense_nn
print(coo, id(coo), sep='\n')
save = coo.__save__()
with open('temp.save', 'wb') as f:
pickle.dump(save, f)
with open('temp.save', 'rb') as f:
save2 = pickle.load(f)
print(coo2 := load(*save2), id(coo2), sep='\n')
# save = coo2.__save__()
# with open('temp.save', 'wb') as f:
# pickle.dump(save, f)