Merge branch 'master' of ssh://gogs@the-cake-is-a-lie.net:20022/jonas/NLP-LAB.git
This commit is contained in:
commit
dfba9ce9ae
@ -144,7 +144,7 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
"model_id": "d018a59d95fe45f2ae7be013a49b5900",
|
"model_id": "a4899ee1720f4db4a136a96657f3283a",
|
||||||
"version_major": 2,
|
"version_major": 2,
|
||||||
"version_minor": 0
|
"version_minor": 0
|
||||||
},
|
},
|
||||||
@ -495,7 +495,7 @@
|
|||||||
" p = progress_indicator()\n",
|
" p = progress_indicator()\n",
|
||||||
" \n",
|
" \n",
|
||||||
" tr = stl.trainer(sdm=sdm, pm=pm)\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",
|
||||||
"\n",
|
"\n",
|
||||||
"# linking:\n",
|
"# linking:\n",
|
||||||
|
@ -633,14 +633,15 @@ class trainer(object):
|
|||||||
named_steps[s].fit = lambda self, X, y=None: self
|
named_steps[s].fit = lambda self, X, y=None: self
|
||||||
named_steps[s].fit_transform = named_steps[s].transform
|
named_steps[s].fit_transform = named_steps[s].transform
|
||||||
|
|
||||||
for k in keras_batch_fitting_layer:
|
if batch_size is not None:
|
||||||
# forcing batch fitting on keras
|
for k in keras_batch_fitting_layer:
|
||||||
disabled_keras_fits[k]=named_steps[k].fit
|
# 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:
|
if batch_size is None:
|
||||||
self.pm.fit(X = self.sdm.X[:max_size], y = self.sdm.y[:max_size])
|
self.pm.fit(X = self.sdm.X[:max_size], y = self.sdm.y[:max_size], validation_split=0.1, epochs=n_epochs)
|
||||||
else:
|
else:
|
||||||
n = len(self.sdm.X) // batch_size
|
n = len(self.sdm.X) // batch_size
|
||||||
for i in range(n_epochs):
|
for i in range(n_epochs):
|
||||||
@ -658,8 +659,9 @@ class trainer(object):
|
|||||||
named_steps[s].fit = disabled_fits[s]
|
named_steps[s].fit = disabled_fits[s]
|
||||||
named_steps[s].fit_transform = disabled_fit_transforms[s]
|
named_steps[s].fit_transform = disabled_fit_transforms[s]
|
||||||
|
|
||||||
for k in keras_batch_fitting_layer:
|
if batch_size is not None:
|
||||||
named_steps[k].fit = disabled_keras_fits[k]
|
for k in keras_batch_fitting_layer:
|
||||||
|
named_steps[k].fit = disabled_keras_fits[k]
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user