diff --git a/biomes/model.py b/biomes/model.py index d581ae1..fc07985 100644 --- a/biomes/model.py +++ b/biomes/model.py @@ -99,8 +99,8 @@ class Model(): def save(self, path): logger.debug('Saving model weights to path: %s', path) - self.model.save_weights(path + '/checkpoint.hd5') - return path + '/checkpoint' + self.model.save_weights(path + '/checkpoint.h5', save_format='h5') + return path + '/checkpoint.h5' def evaluate(self): return self.model.evaluate( diff --git a/biomes/train.py b/biomes/train.py index b369b4c..2f67f2f 100644 --- a/biomes/train.py +++ b/biomes/train.py @@ -10,7 +10,7 @@ from model import Model B_params = { 'batch_size': tune.grid_search([256]), 'layers': tune.grid_search([[512, 512]]), - 'lr': tune.grid_search([1e-4]), + 'lr': tune.grid_search([3e-4]), 'optimizer': tune.grid_search([tf.keras.optimizers.Adam]), } @@ -46,8 +46,8 @@ class TuneB(tune.Trainable): return self.model.restore(path) A_params = { - 'batch_size': tune.grid_search([32]), - 'layers': tune.grid_search([[32, 32]]), + 'batch_size': tune.grid_search([128]), + 'layers': tune.grid_search([[64, 64]]), 'lr': tune.grid_search([1e-4]), 'optimizer': tune.grid_search([tf.keras.optimizers.Adam]), } diff --git a/map-generator/index.py b/map-generator/index.py index c2314d2..7bfbea0 100644 --- a/map-generator/index.py +++ b/map-generator/index.py @@ -163,8 +163,8 @@ def continent_agent(ground, position, size): while True: # if trials > CONTINENT_MAX_TRIALS: # print('couldnt proceed') - # if size <= 0 or trials > CONTINENT_MAX_TRIALS: break - if size <= 0: break + if size <= 0 or trials > CONTINENT_MAX_TRIALS: break + # if size <= 0: break dx = np.random.randint(2) or -1 dy = np.random.randint(2) or -1 @@ -184,8 +184,8 @@ def continent_agent(ground, position, size): trials = 0 size -= 1 ground[x, y] = np.random.randint(1, p['ground_noise']) - # else: - # trials += 1 + else: + trials += 1 def neighbours(ground, position, radius): x, y = position @@ -271,7 +271,7 @@ def generate_map(**kwargs): ym = ym * -1 - random_size = ground_size / continents + random_size = ground_size / continents continent_agent(ground, position, size=random_size) ground = ndimage.gaussian_filter(ground, sigma=(1 - p['sharpness']) * 20) diff --git a/map-generator/static/script.js b/map-generator/static/script.js index 61a7a56..18b3ed0 100644 --- a/map-generator/static/script.js +++ b/map-generator/static/script.js @@ -12,7 +12,7 @@ function generate() { const queryString = new URLSearchParams(formData).toString() map.src = '/map?' + queryString; map.classList.add('d-none'); - + map.width = formData.get('width'); } mapSettings.addEventListener('submit', (e) => { diff --git a/map-generator/templates/index.html b/map-generator/templates/index.html index aef86ab..ca5d665 100644 --- a/map-generator/templates/index.html +++ b/map-generator/templates/index.html @@ -21,7 +21,7 @@