From 9dddd1134dd883289c29fcd15054a23fbebc2bb1 Mon Sep 17 00:00:00 2001 From: B4ckslash Date: Thu, 23 Nov 2023 15:22:37 +0100 Subject: [PATCH] fix: move python header comments below shebang in some backends (#1321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix python header comments for some extra gRPC backends When a Python script is to be executed directly via exec(3), either the platform knows how to execute the file itself (i.e. special configuration is necessary) or the first line contains a shebang (#!) specifying the interpreter to run it (similar to shell scripts). The shebang MUST be on the first line for the script to work on all platforms, so any header comments need to be in the lines following it. Otherwise executing these scripts as extra backends will yield an "exec format error" message. Changes: * Move introductory comments below the shebang line * Change header comment in transformers.py to refer to the correct python module Signed-off-by: Marcus Köhler * Make header comment in ttsbark.py more specific Signed-off-by: Marcus Köhler --------- Signed-off-by: Marcus Köhler --- backend/python/bark/ttsbark.py | 7 +++---- .../python/sentencetransformers/sentencetransformers.py | 2 +- backend/python/transformers/transformers.py | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/python/bark/ttsbark.py b/backend/python/bark/ttsbark.py index d9891b39..050c44ed 100644 --- a/backend/python/bark/ttsbark.py +++ b/backend/python/bark/ttsbark.py @@ -1,8 +1,7 @@ -""" -This is the extra gRPC server of LocalAI -""" - #!/usr/bin/env python3 +""" +This is an extra gRPC server of LocalAI for Bark TTS +""" from concurrent import futures import time import argparse diff --git a/backend/python/sentencetransformers/sentencetransformers.py b/backend/python/sentencetransformers/sentencetransformers.py index 03740917..905015e1 100755 --- a/backend/python/sentencetransformers/sentencetransformers.py +++ b/backend/python/sentencetransformers/sentencetransformers.py @@ -1,7 +1,7 @@ +#!/usr/bin/env python3 """ Extra gRPC server for HuggingFace SentenceTransformer models. """ -#!/usr/bin/env python3 from concurrent import futures import argparse diff --git a/backend/python/transformers/transformers.py b/backend/python/transformers/transformers.py index 03a48169..7d8d872b 100755 --- a/backend/python/transformers/transformers.py +++ b/backend/python/transformers/transformers.py @@ -1,7 +1,7 @@ -""" -Extra gRPC server for HuggingFace SentenceTransformer models. -""" #!/usr/bin/env python3 +""" +Extra gRPC server for HuggingFace AutoModel models. +""" from concurrent import futures import argparse