From 85a3cc8d8fdd80dad279a823c14a3d21e330b5b8 Mon Sep 17 00:00:00 2001 From: Josh Bennett <562773+joshbtn@users.noreply.github.com> Date: Thu, 10 Oct 2024 04:42:59 -0400 Subject: [PATCH] feat(transformers): Use downloaded model for Transformers backend if it already exists. (#3777) * signing commit Signed-off-by: Josh Bennett <562773+joshbtn@users.noreply.github.com> * Update transformers backend to check for existing model directory Signed-off-by: Josh Bennett <562773+joshbtn@users.noreply.github.com> --------- Signed-off-by: Josh Bennett <562773+joshbtn@users.noreply.github.com> --- backend/python/transformers/backend.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/python/transformers/backend.py b/backend/python/transformers/backend.py index 6e809f28..2075012e 100644 --- a/backend/python/transformers/backend.py +++ b/backend/python/transformers/backend.py @@ -72,7 +72,12 @@ class BackendServicer(backend_pb2_grpc.BackendServicer): Returns: A Result object that contains the result of the LoadModel operation. """ + model_name = request.Model + + # Check to see if the Model exists in the filesystem already. + if os.path.exists(request.ModelFile): + model_name = request.ModelFile compute = torch.float16 if request.F16Memory == True: