"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "8eb7f26d5d9ce42eb88be6f0150b22a41d76a93d"
Unverified Commit 5e080c11 authored by Nicolas Patry's avatar Nicolas Patry Committed by GitHub
Browse files

Updating the doctest for conversational. (#20236)

* Updating the doctest for conversational.

- Make it tested against
- Add explicit output in the test.

* Removing assert.

* Adding missing link.
parent 860ea8a5
......@@ -164,6 +164,25 @@ class ConversationalPipeline(Pipeline):
"""
Multi-turn conversational pipeline.
Example:
```python
>>> from transformers import pipeline, Conversation
>>> chatbot = pipeline(model="microsoft/DialoGPT-medium")
>>> conversation = Conversation("Going to the movies tonight - any suggestions?")
>>> conversation = chatbot(conversation)
>>> conversation.generated_responses[-1]
'The Big Lebowski'
>>> conversation.add_user_input("Is it an action movie?")
>>> conversation = chatbot(conversation)
>>> conversation.generated_responses[-1]
"It's a comedy."
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
This conversational pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"conversational"`.
......@@ -171,22 +190,7 @@ class ConversationalPipeline(Pipeline):
currently: *'microsoft/DialoGPT-small'*, *'microsoft/DialoGPT-medium'*, *'microsoft/DialoGPT-large'*. See the
up-to-date list of available models on
[huggingface.co/models](https://huggingface.co/models?filter=conversational).
Usage:
```python
conversational_pipeline = pipeline("conversational")
conversation_1 = Conversation("Going to the movies tonight - any suggestions?")
conversation_2 = Conversation("What's the last book you have read?")
conversational_pipeline([conversation_1, conversation_2])
conversation_1.add_user_input("Is it an action movie?")
conversation_2.add_user_input("What is the genre of this book?")
conversational_pipeline([conversation_1, conversation_2])
```"""
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment