Skip to content

Commit

Permalink
Improved the code quality to ease future maintenance (#248)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Wyatt <[email protected]>
  • Loading branch information
blackmambaza and mrwyattii authored Oct 12, 2023
1 parent ab6b544 commit 62d3793
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 27 deletions.
42 changes: 22 additions & 20 deletions mii/grpc_related/proto/modelresponse_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,65 +74,67 @@ def __init__(self, channel):

class ModelResponseServicer(object):
"""Missing associated documentation comment in .proto file."""
ERROR_MSG = 'Method not implemented!'

def Terminate(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def CreateSession(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def DestroySession(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def GeneratorReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def ClassificationReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def QuestionAndAnswerReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def FillMaskReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def TokenClassificationReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def ConversationalReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)

def Txt2ImgReply(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details(self.ERROR_MSG)
raise NotImplementedError(self.ERROR_MSG)


def add_ModelResponseServicer_to_server(servicer, server):
Expand Down
4 changes: 3 additions & 1 deletion mii/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ def _launch_server_process(self,
model_config,
msg_server_type,
ds_launch_str="",
server_args=[]):
server_args=None):
launch_str = f"{sys.executable} -m mii.launch.multi_gpu_server"
b64_config_str = config_to_b64_str(model_config)
if server_args is None:
server_args = []
server_args.append(f"--model-config {b64_config_str}")
server_args_str = " ".join(server_args)
cmd = f"{ds_launch_str} {launch_str} {server_args_str}".strip().split(" ")
Expand Down
16 changes: 10 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,19 @@ def command_exists(cmd):
# Build specifiers like .devX can be added at install time. Otherwise, add the git hash.
# example: MII_BUILD_STR=".dev20201022" python setup.py sdist bdist_wheel

MII_BUILD_STRING = 'MII_BUILD_STRING'
BUILD_FILE = 'build.txt'
mii_build_string = os.environ.get(MII_BUILD_STRING)

# Building wheel for distribution, update version file
if 'MII_BUILD_STRING' in os.environ:
if mii_build_string:
# Build string env specified, probably building for distribution
with open('build.txt', 'w') as fd:
fd.write(os.environ.get('MII_BUILD_STRING'))
version_str += os.environ.get('MII_BUILD_STRING')
elif os.path.isfile('build.txt'):
with open(BUILD_FILE, 'w') as fd:
fd.write(mii_build_string)
version_str += mii_build_string
elif os.path.isfile(BUILD_FILE):
# build.txt exists, probably installing from distribution
with open('build.txt', 'r') as fd:
with open(BUILD_FILE, 'r') as fd:
version_str += fd.read().strip()
else:
# None of the above, probably installing from source
Expand Down

0 comments on commit 62d3793

Please sign in to comment.