In order to fine-tune the model, we need to know which one is the latest model and its corresponding checkpoint to restore weights and biases. Therefore, we call the /model endpoint to get the checkpoint name and a version number:
def get_latest_model(url): response = requests.get("%s/model" % url) data = json.loads(response.text) print(data) return data["ckpt_name"], int(data["version"])
The response JSON should look like this:
{ "ckpt_name": "2017-05-26_02-12-49", "id": 10, "link": "http://1.53.110.161:8181/pet-model/8.zip", "name": "pet-model", "version": 8 }
Now, we will implement the code to fine-tune the model. Let's start with some parameters:
# Server info URL = "http://localhost:5000" dest_api ...