some keras batch size fixes
This commit is contained in:
parent
c59a58c672
commit
84aa7f288f
@ -144,7 +144,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "d018a59d95fe45f2ae7be013a49b5900",
|
||||
"model_id": "6b0243a17f70405fb3bbb83918efd12e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@ -495,7 +495,7 @@
|
||||
" p = progress_indicator()\n",
|
||||
" \n",
|
||||
" tr = stl.trainer(sdm=sdm, pm=pm)\n",
|
||||
" tr.fit(progress_callback=p.update, batch_size=batch_size, n_epochs=n_epochs)\n",
|
||||
" tr.fit(progress_callback=p.update, batch_size=batch_size if batch_size > 0 else None, n_epochs=n_epochs)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"# linking:\n",
|
||||
|
@ -633,11 +633,12 @@ class trainer(object):
|
||||
named_steps[s].fit = lambda self, X, y=None: self
|
||||
named_steps[s].fit_transform = named_steps[s].transform
|
||||
|
||||
for k in keras_batch_fitting_layer:
|
||||
# forcing batch fitting on keras
|
||||
disabled_keras_fits[k]=named_steps[k].fit
|
||||
if batch_size is None:
|
||||
for k in keras_batch_fitting_layer:
|
||||
# forcing batch fitting on keras
|
||||
disabled_keras_fits[k]=named_steps[k].fit
|
||||
|
||||
named_steps[k].fit = lambda X, y: named_steps[k].train_on_batch(to_dense_if_sparse(X), y) # ← why has keras no sparse support on batch progressing!?!?!
|
||||
named_steps[k].fit = lambda X, y: named_steps[k].train_on_batch(to_dense_if_sparse(X), y) # ← why has keras no sparse support on batch progressing!?!?!
|
||||
|
||||
if batch_size is None:
|
||||
self.pm.fit(X = self.sdm.X[:max_size], y = self.sdm.y[:max_size])
|
||||
@ -658,8 +659,9 @@ class trainer(object):
|
||||
named_steps[s].fit = disabled_fits[s]
|
||||
named_steps[s].fit_transform = disabled_fit_transforms[s]
|
||||
|
||||
for k in keras_batch_fitting_layer:
|
||||
named_steps[k].fit = disabled_keras_fits[k]
|
||||
if batch_size is None:
|
||||
for k in keras_batch_fitting_layer:
|
||||
named_steps[k].fit = disabled_keras_fits[k]
|
||||
|
||||
def test(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user