Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use tokenizer.apply_chat_template() in vLLM #1990

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions backend/backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ message PredictOptions {
string NegativePrompt = 40;
int32 NDraft = 41;
repeated string Images = 42;
bool UseTokenizerTemplate = 43;
repeated Message Messages = 44;
}

// The response message containing the result
Expand Down Expand Up @@ -256,3 +258,8 @@ message StatusResponse {
State state = 1;
MemoryUsageData memory = 2;
}

message Message {
string role = 1;
string content = 2;
}
98 changes: 58 additions & 40 deletions backend/python/autogptq/backend_pb2.py

Large diffs are not rendered by default.

132 changes: 132 additions & 0 deletions backend/python/autogptq/backend_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,26 @@ def __init__(self, channel):
request_serializer=backend__pb2.HealthMessage.SerializeToString,
response_deserializer=backend__pb2.StatusResponse.FromString,
)
self.StoresSet = channel.unary_unary(
'/backend.Backend/StoresSet',
request_serializer=backend__pb2.StoresSetOptions.SerializeToString,
response_deserializer=backend__pb2.Result.FromString,
)
self.StoresDelete = channel.unary_unary(
'/backend.Backend/StoresDelete',
request_serializer=backend__pb2.StoresDeleteOptions.SerializeToString,
response_deserializer=backend__pb2.Result.FromString,
)
self.StoresGet = channel.unary_unary(
'/backend.Backend/StoresGet',
request_serializer=backend__pb2.StoresGetOptions.SerializeToString,
response_deserializer=backend__pb2.StoresGetResult.FromString,
)
self.StoresFind = channel.unary_unary(
'/backend.Backend/StoresFind',
request_serializer=backend__pb2.StoresFindOptions.SerializeToString,
response_deserializer=backend__pb2.StoresFindResult.FromString,
)


class BackendServicer(object):
Expand Down Expand Up @@ -129,6 +149,30 @@ def Status(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def StoresSet(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!')

def StoresDelete(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!')

def StoresGet(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!')

def StoresFind(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!')


def add_BackendServicer_to_server(servicer, server):
rpc_method_handlers = {
Expand Down Expand Up @@ -182,6 +226,26 @@ def add_BackendServicer_to_server(servicer, server):
request_deserializer=backend__pb2.HealthMessage.FromString,
response_serializer=backend__pb2.StatusResponse.SerializeToString,
),
'StoresSet': grpc.unary_unary_rpc_method_handler(
servicer.StoresSet,
request_deserializer=backend__pb2.StoresSetOptions.FromString,
response_serializer=backend__pb2.Result.SerializeToString,
),
'StoresDelete': grpc.unary_unary_rpc_method_handler(
servicer.StoresDelete,
request_deserializer=backend__pb2.StoresDeleteOptions.FromString,
response_serializer=backend__pb2.Result.SerializeToString,
),
'StoresGet': grpc.unary_unary_rpc_method_handler(
servicer.StoresGet,
request_deserializer=backend__pb2.StoresGetOptions.FromString,
response_serializer=backend__pb2.StoresGetResult.SerializeToString,
),
'StoresFind': grpc.unary_unary_rpc_method_handler(
servicer.StoresFind,
request_deserializer=backend__pb2.StoresFindOptions.FromString,
response_serializer=backend__pb2.StoresFindResult.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'backend.Backend', rpc_method_handlers)
Expand Down Expand Up @@ -361,3 +425,71 @@ def Status(request,
backend__pb2.StatusResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def StoresSet(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/backend.Backend/StoresSet',
backend__pb2.StoresSetOptions.SerializeToString,
backend__pb2.Result.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def StoresDelete(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/backend.Backend/StoresDelete',
backend__pb2.StoresDeleteOptions.SerializeToString,
backend__pb2.Result.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def StoresGet(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/backend.Backend/StoresGet',
backend__pb2.StoresGetOptions.SerializeToString,
backend__pb2.StoresGetResult.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def StoresFind(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/backend.Backend/StoresFind',
backend__pb2.StoresFindOptions.SerializeToString,
backend__pb2.StoresFindResult.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Loading