mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-16 08:17:45 +01:00
add task chat for all chat models, like chatglm-6B (#213)
* add task chat * update output format --------- Co-authored-by: Zhicheng Zhang <zhangzhicheng.zzc@alibaba-inc.com>
This commit is contained in:
@@ -50,6 +50,7 @@ task_default_metrics = {
|
||||
Tasks.sentiment_classification: [Metrics.seq_cls_metric],
|
||||
Tasks.token_classification: [Metrics.token_cls_metric],
|
||||
Tasks.text_generation: [Metrics.text_gen_metric],
|
||||
Tasks.chat: [Metrics.text_gen_metric],
|
||||
Tasks.text_classification: [Metrics.seq_cls_metric],
|
||||
Tasks.image_denoising: [Metrics.image_denoise_metric],
|
||||
Tasks.image_deblurring: [Metrics.image_denoise_metric],
|
||||
|
||||
@@ -736,6 +736,13 @@ TASK_OUTPUTS = {
|
||||
# }
|
||||
Tasks.text_generation: [OutputKeys.TEXT],
|
||||
|
||||
# chat task result for single sample
|
||||
# {
|
||||
# "response": "this is the chat response generated by a model.",
|
||||
# "history": [("hi", "nice to meet you"),("I felt happy, and you", "me too")]
|
||||
# }
|
||||
Tasks.chat: [OutputKeys.RESPONSE, OutputKeys.HISTORY],
|
||||
|
||||
# fid dialogue result for single sample
|
||||
# {
|
||||
# "text": "My name is Mike"
|
||||
|
||||
@@ -173,6 +173,10 @@ TASK_INPUTS = {
|
||||
InputType.IMAGE,
|
||||
|
||||
# ============ nlp tasks ===================
|
||||
Tasks.chat: {
|
||||
'text': InputType.TEXT,
|
||||
'history': InputType.LIST,
|
||||
},
|
||||
Tasks.text_classification: [
|
||||
InputType.TEXT,
|
||||
(InputType.TEXT, InputType.TEXT),
|
||||
|
||||
@@ -160,6 +160,8 @@ class CVTasks(object):
|
||||
|
||||
|
||||
class NLPTasks(object):
|
||||
# chat
|
||||
chat = 'chat'
|
||||
# nlp tasks
|
||||
word_segmentation = 'word-segmentation'
|
||||
part_of_speech = 'part-of-speech'
|
||||
|
||||
Reference in New Issue
Block a user