Hugging Face 파이프라인에 대한 추론된 서명¶
Snowflake Model Registry는 다음 목록에서 단일 작업을 포함하는 Hugging Face 파이프라인의 시그니처를 자동으로 추론합니다.
conversational
fill-mask
question-answering
summarization
table-question-answering
text2text-generation
text-classification
(별칭은sentiment-analysis
)text-generation
token-classification
(별칭은ner
)translation
translation_xx_to_yy
zero-shot-classification
이 항목에서는 필요한 입력 및 예상 출력에 대한 설명과 예제를 포함하여 이러한 유형의 Hugging Face 파이프라인의 서명에 대해 설명합니다. 모든 입력과 출력은 Snowpark DataFrames입니다.
레지스트리에 Hugging Face 파이프라인을 기록하는 방법에 대한 일반적인 지침은 Hugging Face 파이프라인 섹션을 참조하십시오.
대화형 파이프라인¶
작업이 대화형 인 파이프라인으로, 입력과 출력은 다음과 같습니다.
입력¶
user_inputs
: 사용자의 이전 입력과 현재 입력을 나타내는 문자열 목록입니다. 목록의 마지막 항목은 현재 입력입니다.generated_responses
: 모델의 이전 응답을 나타내는 문자열 목록입니다.
예:
---------------------------------------------------------------------------
|"user_inputs" |"generated_responses" |
---------------------------------------------------------------------------
|[ |[ |
| "Do you speak French?", | "Yes I do." |
| "Do you know how to say Snowflake in French?" |] |
|] | |
---------------------------------------------------------------------------
출력¶
generated_responses
: 모델의 이전 응답과 현재 응답을 나타내는 문자열 목록입니다. 목록의 마지막 항목은 현재 응답입니다.
예:
-------------------------
|"generated_responses" |
-------------------------
|[ |
| "Yes I do.", |
| "I speak French." |
|] |
-------------------------
마스크 채우기 파이프라인¶
작업이 “마스크 채우기 “ 인 파이프라인으로, 입력과 출력은 다음과 같습니다.
입력¶
inputs
: 채워야 할 마스크가 있는 문자열입니다.
예:
--------------------------------------------------
|"inputs" |
--------------------------------------------------
|LynYuu is the [MASK] of the Grand Duchy of Yu. |
--------------------------------------------------
출력¶
outputs
: 오브젝트 목록의 JSON 표현이 포함된 문자열로, 각 키에는score
,token
,token_str
또는sequence
같은 키가 포함될 수 있습니다. 자세한 내용은 FillMaskPipeline 섹션을 참조하십시오.
예:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|"outputs" |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|[{"score": 0.9066258072853088, "token": 3007, "token_str": "capital", "sequence": "lynyuu is the capital of the grand duchy of yu."}, {"score": 0.08162177354097366, "token": 2835, "token_str": "seat", "sequence": "lynyuu is the seat of the grand duchy of yu."}, {"score": 0.0012052370002493262, "token": 4075, "token_str": "headquarters", "sequence": "lynyuu is the headquarters of the grand duchy of yu."}, {"score": 0.0006560495239682496, "token": 2171, "token_str": "name", "sequence": "lynyuu is the name of the grand duchy of yu."}, {"score": 0.0005427763098850846, "token": 3200, "token_str"... |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
토큰 분류¶
작업이 “ner” 또는 “token-classification “인 파이프라인으로, 입력과 출력은 다음과 같습니다.
입력¶
inputs
: 분류할 토큰이 포함된 문자열입니다.
예:
------------------------------------------------
|"inputs" |
------------------------------------------------
|My name is Izumi and I live in Tokyo, Japan. |
------------------------------------------------
출력¶
outputs
: 결과 오브젝트 목록의 JSON 표현이 포함된 문자열로, 각 키에는entity
,score
,index
,word
,name
,start
또는end
같은 키가 포함될 수 있습니다. 자세한 내용은 TokenClassificationPipeline 섹션을 참조하십시오.
예:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|"outputs" |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|[{"entity": "PRON", "score": 0.9994392991065979, "index": 1, "word": "my", "start": 0, "end": 2}, {"entity": "NOUN", "score": 0.9968984127044678, "index": 2, "word": "name", "start": 3, "end": 7}, {"entity": "AUX", "score": 0.9937735199928284, "index": 3, "word": "is", "start": 8, "end": 10}, {"entity": "PROPN", "score": 0.9928083419799805, "index": 4, "word": "i", "start": 11, "end": 12}, {"entity": "PROPN", "score": 0.997334361076355, "index": 5, "word": "##zumi", "start": 12, "end": 16}, {"entity": "CCONJ", "score": 0.999173104763031, "index": 6, "word": "and", "start": 17, "end": 20}, {... |
쿼리 응답(단일 출력)¶
작업이 “question-answering “인 파이프라인으로, 여기서 top_k
는 설정 취소되거나 1로 설정되고, 입력과 출력은 다음과 같습니다.
입력¶
question
: 답변할 질문이 포함된 문자열입니다.context
: 답변을 포함할 수 있는 문자열입니다.
예:
-----------------------------------------------------------------------------------
|"question" |"context" |
-----------------------------------------------------------------------------------
|What did Doris want to do? |Doris is a cheerful mermaid from the ocean dept... |
-----------------------------------------------------------------------------------
출력¶
score
: 0.0~1.0 사이의 부동소수점 신뢰도 점수입니다.start
: 컨텍스트에서 답변의 첫 번째 토큰의 정수 인덱스입니다.end
: 원래 컨텍스트에서 답변의 마지막 토큰의 정수 인덱스입니다.answer
: 찾은 답변이 포함된 문자열입니다.
예:
--------------------------------------------------------------------------------
|"score" |"start" |"end" |"answer" |
--------------------------------------------------------------------------------
|0.61094731092453 |139 |178 |learn more about the world of athletics |
--------------------------------------------------------------------------------
쿼리 응답(다중 출력)¶
작업이 “question-answering “인 파이프라인으로, 여기서 top_k
는 설정되고 1보다 큰 값이며, 입력과 출력은 다음과 같습니다.
입력¶
question
: 답변할 질문이 포함된 문자열입니다.context
: 답변을 포함할 수 있는 문자열입니다.
예:
-----------------------------------------------------------------------------------
|"question" |"context" |
-----------------------------------------------------------------------------------
|What did Doris want to do? |Doris is a cheerful mermaid from the ocean dept... |
-----------------------------------------------------------------------------------
출력¶
outputs
: 결과 오브젝트 목록의 JSON 표현이 포함된 문자열로, 각 키에는score
,start
,end
또는answer
같은 키가 포함될 수 있습니다.
예:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|"outputs" |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|[{"score": 0.61094731092453, "start": 139, "end": 178, "answer": "learn more about the world of athletics"}, {"score": 0.17750297486782074, "start": 139, "end": 180, "answer": "learn more about the world of athletics.\""}, {"score": 0.06438097357749939, "start": 138, "end": 178, "answer": "\"learn more about the world of athletics"}] |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
요약¶
작업이 “요약 “ 인 파이프라인으로, 여기서 return_tensors
는 False 또는 설정 취소되며, 입력과 출력은 다음과 같습니다.
입력¶
documents
: 요약할 텍스트가 포함된 문자열입니다.
예:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|"documents" |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|Neuro-sama is a chatbot styled after a female VTuber that hosts live streams on the Twitch channel "vedal987". Her speech and personality are generated by an artificial intelligence (AI) system wh... |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
출력¶
summary_text
: 생성된 요약이 포함된 문자열 또는num_return_sequences
가 1보다 큰 경우 결과 목록의 JSON 표현식이 포함된 문자열이며, 각 문자열은summary_text
를 포함한 필드가 포함된 사전입니다.
예:
---------------------------------------------------------------------------------
|"summary_text" |
---------------------------------------------------------------------------------
| Neuro-sama is a chatbot styled after a female VTuber that hosts live streams |
---------------------------------------------------------------------------------
테이블 질문 답변¶
작업이 table-question-answering 인 파이프라인으로, 입력과 출력은 다음과 같습니다.
입력¶
query
: 답변할 질문이 포함된 문자열입니다.table
: 답변을 포함할 수 있는 테이블을 나타내는{column -> [values]}
형식의 JSON 직렬화 사전이 포함된 문자열입니다.
예:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|"query" |"table" |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|Which channel has the most subscribers? |{"Channel": ["A.I.Channel", "Kaguya Luna", "Mirai Akari", "Siro"], "Subscribers": ["3,020,000", "872,000", "694,000", "660,000"], "Videos": ["1,200", "113", "639", "1,300"], "Created At": ["Jun 30 2016", "Dec 4 2017", "Feb 28 2014", "Jun 23 2017"]} |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
출력¶
answer
: 가능한 답변이 포함된 문자열입니다.coordinates
: 답변이 이 위치한 셀의 좌표를 나타내는 정수 목록입니다.cells
: 답변이 위치한 셀의 내용이 포함된 문자열 목록입니다.aggregator
: 사용된 집계 장치의 이름이 포함된 문자열입니다.
예:
----------------------------------------------------------------
|"answer" |"coordinates" |"cells" |"aggregator" |
----------------------------------------------------------------
|A.I.Channel |[ |[ |NONE |
| | [ | "A.I.Channel" | |
| | 0, |] | |
| | 0 | | |
| | ] | | |
| |] | | |
----------------------------------------------------------------
텍스트 분류(단일 출력)¶
작업이 “text-clasification “ 또는 “sentiment-analysis”인 파이프라인으로, 여기서 top_k
는 설정되지 않거나 None이며, 입력과 출력은 다음과 같습니다.
입력¶
text
: 분류할 문자열입니다.text_pair
:text
로 분류되는 문자열로, 텍스트 유사도를 계산하는 모델과 함께 사용됩니다. 모델에서 사용하지 않으면 비워둡니다.
예:
----------------------------------
|"text" |"text_pair" |
----------------------------------
|I like you. |I love you, too. |
----------------------------------
출력¶
label
: 텍스트의 분류 레이블을 나타내는 문자열입니다.score
: 0.0~1.0 사이의 부동소수점 신뢰도 점수입니다.
예:
--------------------------------
|"label" |"score" |
--------------------------------
|LABEL_0 |0.9760091304779053 |
--------------------------------
텍스트 분류(다중 출력)¶
작업이 “text-clasification “ 또는 “sentiment-analysis”인 파이프라인으로, 여기서 top_k
는 숫자로 설정되며, 입력과 출력은 다음과 같습니다.
참고
텍스트 분류 작업은 top_k
가 임의의 숫자로 설정되어 있으면 그 숫자가 1이더라도 다중 출력으로 간주됩니다. 단일 출력 을 얻으려면 None의 top_k
값을 사용합니다.
입력¶
text
: 분류할 문자열입니다.text_pair
:text
로 분류되는 문자열로, 텍스트 유사도를 계산하는 모델과 함께 사용됩니다. 모델에서 사용하지 않으면 비워둡니다.
예:
--------------------------------------------------------------------
|"text" |"text_pair" |
--------------------------------------------------------------------
|I am wondering if I should have udon or rice fo... | |
--------------------------------------------------------------------
출력¶
outputs
: 결과 목록의 JSON 표현을 포함하는 문자열로, 각 목록에는label
및score
등의 필드가 포함되어 있습니다.
예:
--------------------------------------------------------
|"outputs" |
--------------------------------------------------------
|[{"label": "NEGATIVE", "score": 0.9987024068832397}] |
--------------------------------------------------------
텍스트 생성¶
작업이 “text-generation “ 인 파이프라인으로, 여기서 return_tensors
는 False 또는 설정 취소되며, 입력과 출력은 다음과 같습니다.
참고
return_tensors
가 True인 텍스트 생성 파이프라인은 지원되지 않습니다.
입력¶
inputs
: 프롬프트가 포함된 문자열입니다.
예:
--------------------------------------------------------------------------------
|"inputs" |
--------------------------------------------------------------------------------
|A descendant of the Lost City of Atlantis, who swam to Earth while saying, " |
--------------------------------------------------------------------------------
출력¶
outputs
: 결과 오브젝트 목록의 JSON을 나타내는 문자열로, 각 필드에는generated_text
등의 필드가 포함됩니다.
예:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|"outputs" |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|[{"generated_text": "A descendant of the Lost City of Atlantis, who swam to Earth while saying, \"For my life, I don't know if I'm gonna land upon Earth.\"\n\nIn \"The Misfits\", in a flashback, wh... |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
텍스트-텍스트 생성¶
작업이 “text2text-generation “ 인 파이프라인으로, 여기서 return_tensors
는 False 또는 설정 취소되며, 입력과 출력은 다음과 같습니다.
참고
return_tensors
가 True인 텍스트-텍스트 생성 파이프라인은 지원되지 않습니다.
입력¶
inputs
: 프롬프트가 포함된 문자열입니다.
예:
--------------------------------------------------------------------------------
|"inputs" |
--------------------------------------------------------------------------------
|A descendant of the Lost City of Atlantis, who swam to Earth while saying, " |
--------------------------------------------------------------------------------
출력¶
generated_text:
num_return_sequences
가 1이면 생성된 텍스트를 포함하는 문자열, num_return_sequences가 1보다 크면generated_text
를 포함한 필드를 포함하는 결과 사전의 JSON 목록을 문자열로 표현합니다.
예:
----------------------------------------------------------------
|"generated_text" |
----------------------------------------------------------------
|, said that he was a descendant of the Lost City of Atlantis |
----------------------------------------------------------------
번역 생성¶
작업이 “번역 “ 인 파이프라인으로, 여기서 return_tensors
는 False 또는 설정 취소되며, 입력과 출력은 다음과 같습니다.
참고
return_tensors
가 True인 번역 생성 파이프라인은 지원되지 않습니다.
입력¶
inputs
: 번역할 텍스트가 포함된 문자열입니다.
예:
------------------------------------------------------------------------------------------------------
|"inputs" |
------------------------------------------------------------------------------------------------------
|Snowflake's Data Cloud is powered by an advanced data platform provided as a self-managed service. |
------------------------------------------------------------------------------------------------------
출력¶
translation_text
:num_return_sequences
가 1인 경우 생성된 번역을 나타내는 문자열 또는translation_text
등 필드가 각각 포함된 결과 사전의 JSON 목록을 나타내는 문자열입니다.
예:
---------------------------------------------------------------------------------------------------------------------------------
|"translation_text" |
---------------------------------------------------------------------------------------------------------------------------------
|Le Cloud de données de Snowflake est alimenté par une plate-forme de données avancée fournie sous forme de service autogérés. |
---------------------------------------------------------------------------------------------------------------------------------
제로샷 분류¶
작업이 zero-shot-classification 인 파이프라인으로, 입력과 출력은 다음과 같습니다.
입력¶
sequences
: 분류할 텍스트가 포함된 문자열입니다.candidate_labels
: 텍스트에 적용할 레이블이 포함된 문자열 목록입니다.
예:
-----------------------------------------------------------------------------------------
|"sequences" |"candidate_labels" |
-----------------------------------------------------------------------------------------
|I have a problem with Snowflake that needs to be resolved asap!! |[ |
| | "urgent", |
| | "not urgent" |
| |] |
|I have a problem with Snowflake that needs to be resolved asap!! |[ |
| | "English", |
| | "Japanese" |
| |] |
-----------------------------------------------------------------------------------------
출력¶
sequence
: 입력 문자열입니다.labels
: 적용된 레이블을 나타내는 문자열 목록입니다.scores
: 각 레이블에 대한 부동소수점 신뢰도 점수 목록입니다.
예:
--------------------------------------------------------------------------------------------------------------
|"sequence" |"labels" |"scores" |
--------------------------------------------------------------------------------------------------------------
|I have a problem with Snowflake that needs to be resolved asap!! |[ |[ |
| | "urgent", | 0.9952737092971802, |
| | "not urgent" | 0.004726255778223276 |
| |] |] |
|I have a problem with Snowflake that needs to be resolved asap!! |[ |[ |
| | "Japanese", | 0.5790848135948181, |
| | "English" | 0.42091524600982666 |
| |] |] |
--------------------------------------------------------------------------------------------------------------