Bugfix: Create 1 model per-gateway
This commit is contained in:
parent
225eb8753a
commit
f0694de02c
1 changed files with 4 additions and 4 deletions
|
@ -12,8 +12,6 @@ class AITrainer {
|
||||||
this.l = log;
|
this.l = log;
|
||||||
this.dataset_fetcher = DatasetFetcher;
|
this.dataset_fetcher = DatasetFetcher;
|
||||||
this.repo_gateway = GatewayRepo;
|
this.repo_gateway = GatewayRepo;
|
||||||
this.model = this.generate_model();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_model() {
|
generate_model() {
|
||||||
|
@ -78,6 +76,8 @@ class AITrainer {
|
||||||
* @return {Promise} A promise that resolves when training and serialisation is complete.
|
* @return {Promise} A promise that resolves when training and serialisation is complete.
|
||||||
*/
|
*/
|
||||||
async train_gateway(gateway_id, destination_filename) {
|
async train_gateway(gateway_id, destination_filename) {
|
||||||
|
let model = this.generate_model();
|
||||||
|
|
||||||
// TODO: Add samples here for locations that the gateway does NOT cover too
|
// TODO: Add samples here for locations that the gateway does NOT cover too
|
||||||
let dataset_input = tf.data.generator(
|
let dataset_input = tf.data.generator(
|
||||||
this.dataset_fetcher.fetch_input.bind(this.dataset_fetcher, gateway_id)
|
this.dataset_fetcher.fetch_input.bind(this.dataset_fetcher, gateway_id)
|
||||||
|
@ -93,12 +93,12 @@ class AITrainer {
|
||||||
.batch(this.settings.ai.batch_size);
|
.batch(this.settings.ai.batch_size);
|
||||||
|
|
||||||
|
|
||||||
let result = await this.model.fitDataset(dataset, {
|
let result = await model.fitDataset(dataset, {
|
||||||
epochs: this.settings.ai.epochs,
|
epochs: this.settings.ai.epochs,
|
||||||
batchSize: this.settings.ai.batch_size
|
batchSize: this.settings.ai.batch_size
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.model.save(`file://${destination_filename}`);
|
await model.save(`file://${destination_filename}`);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue