From 5e3e3f3578ceba204106e117dee00b6b3b0f36f6 Mon Sep 17 00:00:00 2001 From: henk717 Date: Thu, 16 Dec 2021 00:31:51 +0100 Subject: [PATCH] Fix float16 models Forcefully convert float16 models to work on the CPU --- aiserver.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aiserver.py b/aiserver.py index 12d306fe..9fe7c26a 100644 --- a/aiserver.py +++ b/aiserver.py @@ -827,8 +827,10 @@ if(not vars.model in ["InferKit", "Colab", "OAI", "ReadOnly", "TPUMeshTransforme elif(vars.breakmodel): # Use both RAM and VRAM (breakmodel) device_config(model) else: + model = model.to('cpu').float() generator = model.generate else: + model = model.to('cpu').float() generator = model.generate # If custom GPT2 model was chosen elif(vars.model == "GPT2Custom"): @@ -843,6 +845,7 @@ if(not vars.model in ["InferKit", "Colab", "OAI", "ReadOnly", "TPUMeshTransforme model = model.half().to(0) generator = model.generate else: + model = model.to('cpu').float() generator = model.generate # If base HuggingFace model was chosen else: