FluidMLPRegressor crash on fit while running as kr

Hello all,

I found that FluidMLPRegressor will crash the server if I try to .fit while it is making a prediction via .kr. And when I say “while” I’m pretty sure that is very literal–as in, in the middle of making feedforward calculations. If I turn off the trig that is triggering the prediction calculations it is fine.

It’s really not a problem to ask the user to manage this stuff, which is what my code does now, but it did take a little thinking and poking today to try to figure out why my server was crashing… so maybe documenting it would be good. Example code below.



		var xcols = 100;
		var ycols = 3;
		var npoints = 500;
		var xdict = Dictionary.newFrom([
				arg i;
		var ydict = Dictionary.newFrom([
				arg i;

		~xds = FluidDataSet(s);
		~yds = FluidDataSet(s);




		~nn = FluidMLPRegressor(s,[50],FluidMLPRegressor.sigmoid,FluidMLPRegressor.identity);


			arg loss;
			"loss: %".format(loss).postln;

			~synth = {
				arg trigRate = 1;
				var xsig = LFDNoise1.kr(1.dup(xcols)).range(0,1);
				var xbuf = LocalBuf(xcols);
				var ybuf = LocalBuf(ycols);
				var ysig;

					arg val, i;


				ysig = ycols.collect({
					arg i;


// this is very likely to be fine

// then do this

// try this a few times and it will crash one of the times

Yes it is a known “feature” - it also happens in Max. What we thought should happen instead is that fit will block predict. More sensible I think :slight_smile:

1 Like