oluwatosin adewumi commited on
Commit
5187dc7
1 Parent(s): 9a67aad

readme doc added

Browse files
Files changed (1) hide show
  1. README.md +49 -0
README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ thumbnail: https://huggingface.co/front/thumbnails/dialogpt.png
3
+ language:
4
+ - en
5
+ license: cc-by-4.0
6
+ tags:
7
+ - conversational
8
+ - transformers
9
+ datasets:
10
+ - AfriWOZ
11
+ metrics:
12
+ - perplexity
13
+ widget:
14
+ - text: "How I fit chop for here?"
15
+ ---
16
+
17
+ ## DialoGPT_AfriWOZ
18
+ This is a fine-tuned model of DialoGPT (small) on the AfriWOZ dataset. It is intended to be used as a conversational system in Nigeria Pidgin English language.
19
+ The dataset it's trained on is limited in scope, as it covers only certain domains such as restaurants, hotel, taxi, and booking.
20
+ The perplexity achieved on the validation set 38.52.
21
+ * Generation example from an interactive environment:
22
+ |Role | Response |
23
+ |---------|------------|
24
+ |User | I hear say restaurant dey here. |
25
+ |Bot | |
26
+ |User | Abeg you fit tell me which kind chop dey? |
27
+ |Bot | |
28
+ |User | You do well. Thank you. |
29
+ |Bot | |
30
+ Please find the information about preprocessing, training and full details of the DialoGPT in the [original DialoGPT repository](https://github.com/microsoft/DialoGPT)
31
+ The paper for this work can be found on arXiv: [https://arxiv.org/pdf/2204.08083.pdf](https://arxiv.org/pdf/2204.08083.pdf)
32
+ ### How to use
33
+ Now we are ready to try out how the model works as a chatting partner!
34
+ ```python
35
+ from transformers import AutoModelForCausalLM, AutoTokenizer
36
+ import torch
37
+ tokenizer = AutoTokenizer.from_pretrained("tosin/dialogpt_afriwoz_pidgin")
38
+ model = AutoModelForCausalLM.from_pretrained("tosin/dialogpt_afriwoz_pidgin")
39
+ # Let's chat for 5 lines
40
+ for step in range(5):
41
+ # encode the new user input, add the eos_token and return a tensor in Pytorch
42
+ new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')
43
+ # append the new user input tokens to the chat history
44
+ bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
45
+ # generated a response while limiting the total chat history to 1000 tokens,
46
+ chat_history_ids = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
47
+ # pretty print last ouput tokens from bot
48
+ print("DialoGPT_pidgin_Bot: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))
49
+