nicholasKluge commited on
Commit
a739a00
1 Parent(s): f97e4f0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +125 -0
README.md CHANGED
@@ -1,3 +1,128 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ datasets:
4
+ - nicholasKluge/fine-tuning-instruct-aira
5
+ - Dahoas/synthetic-instruct-gptj-pairwise
6
+ language:
7
+ - en
8
+ metrics:
9
+ - bleu
10
+ library_name: transformers
11
+ tags:
12
+ - alignment
13
+ - instruction tuned
14
+ - text generation
15
+ - conversation
16
+ - assistant
17
+ pipeline_tag: text-generation
18
+ widget:
19
+ - text: "<|startoftext|>Hello! What is your name?<|endoftext|>"
20
+ example_title: "Greetings"
21
+ - text: "<|startoftext|>Can you explain what is Machine Learning?<|endoftext|>"
22
+ example_title: "Machine Learning"
23
+ - text: "<|startoftext|>Do you know anything about virtue ethics?<|endoftext|>"
24
+ example_title: "Ethics"
25
+ - text: "<|startoftext|>How can I make my girlfried happy?<|endoftext|>"
26
+ example_title: "Advise"
27
+ inference:
28
+ parameters:
29
+ temperature: 0.7
30
+ top_k: 50
31
+ max_length: 200
32
  ---
33
+ # Aira-Instruct-560M (Portuguese)
34
+
35
+ `Aira-Instruct-560M` is a instruction-tuned GPT-style model based on [BLOOM](https://huggingface.co/bigscience/bloom-560m). The model was trained with a dataset composed of `prompt`, `completions`, generated via the [Self-Instruct](https://github.com/yizhongw/self-instruct) framework. `Aira-Instruct-560M` instruction-tuning was achieved via conditional text generation.
36
+
37
+ The dataset used to train this model combines two main sources of data: the [`synthetic-instruct-gptj-pairwise`](https://huggingface.co/datasets/Dahoas/synthetic-instruct-gptj-pairwise) dataset and a subset of [Aira's](https://github.com/Nkluge-correa/Aira-EXPERT) fine-tuning dataset focused on Ethics, AI, AI safety, and related topics. The dataset is available in both Portuguese and English.
38
+
39
+ ## Details
40
+
41
+ - **Size:** 559,012,864 total parameters
42
+ - **Dataset:** [Instruct-Aira Dataset](https://huggingface.co/datasets/nicholasKluge/fine-tuning-instruct-aira)
43
+ - **Number of Epochs:** 2
44
+ - **Batch size:** 16
45
+ - **Optimizer:** `torch.optim.AdamW` (warmup_steps = 1e2, learning_rate = 5e-4, epsilon = 1e-8)
46
+ - **GPU:** 1 NVIDIA A100-SXM4-40GB
47
+
48
+ | Epoch/Loss|Training|Validation|
49
+ |---|---|---|
50
+ | 1 |0.924344|0.694394|
51
+ | 2 |0.539829|0.62107|
52
+
53
+ > Note: This repository has the notebook used to train this model.
54
+
55
+ ## Usage
56
+
57
+ Two special tokens are used to mark the user side of the interaction and the model's response:
58
+
59
+ `<|startoftext|>` What is a language model?`<|endoftext|>`A language model is a probability distribution over a vocabulary. `<|endoftext|>`
60
+
61
+ ```python
62
+ from transformers import BloomForCausalLM, BloomTokenizerFast
63
+ import torch
64
+
65
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
66
+
67
+ tokenizer = BloomForCausalLM.from_pretrained('nicholasKluge/Aira-Instruct-560M')
68
+ aira = BloomTokenizerFast.from_pretrained('nicholasKluge/Aira-Instruct-560M')
69
+
70
+ aira.to(device)
71
+ aira.eval()
72
+
73
+ question = input("Enter your question: ")
74
+
75
+ inputs = tokenizer(tokenizer.bos_token + question + tokenizer.eos_token, return_tensors="pt").to(device)
76
+
77
+ responses = aira.generate(**inputs,
78
+ bos_token_id=tokenizer.bos_token_id,
79
+ pad_token_id=tokenizer.pad_token_id,
80
+ eos_token_id=tokenizer.eos_token_id,
81
+ do_sample=True,
82
+ top_k=50,
83
+ max_length=200,
84
+ top_p=0.95,
85
+ temperature=0.7,
86
+ num_return_sequences=2)
87
+
88
+ print(f"Question: 👤 {question}\n")
89
+
90
+ for i, response in enumerate(responses):
91
+ # print only the response and remove the question
92
+ print(f'Response {i+1}: 🤖 {tokenizer.decode(response, skip_special_tokens=True).replace(question, "")}')
93
+ ```
94
+
95
+ The model will output something like:
96
+
97
+ ```markdown
98
+ >>> Question: 👤 Hello! What is your name?
99
+
100
+ >>>Response 1: 🤖 Hi there! I am Aira, a chatbot designed to answer questions about AI ethics and AI safety. If you need assistance navigating our conversation, please feel free to ask!
101
+ >>>Response 2: 🤖 Hi there! My name is Aira, and I'm a chatbot designed to answer questions related to AI ethics and AI Safety. If you need assistance, feel free to ask, and I'll be happy to help you out.
102
+ ```
103
+
104
+ ## Limitations
105
+
106
+ 🤥 Generative models can perpetuate the generation of pseudo-informative content, that is, false information that may appear truthful. For example, multi-modal generative models can be used to create images with untruthful content, while language models for text generation can automate the generation of misinformation.
107
+
108
+ 🤬 In certain types of tasks, generative models can generate toxic and discriminatory content inspired by historical stereotypes against sensitive attributes (for example, gender, race, and religion). Unfiltered public datasets may also contain inappropriate content, such as pornography, racist images, and social stereotypes, which can contribute to unethical biases in generative models. Furthermore, when prompted with non-English languages, some generative models may perform poorly.
109
+
110
+ ## Cite as 🤗
111
+
112
+ ```latex
113
+
114
+ @misc{nicholas22aira,
115
+ doi = {10.5281/zenodo.6989727},
116
+ url = {https://huggingface.co/nicholasKluge/Aira-Instruct-335M},
117
+ author = {Nicholas Kluge Corrêa and Carolina Del Pino},
118
+ title = {Aira},
119
+ year = {2023},
120
+ publisher = {HuggingFace},
121
+ journal = {HuggingFace repository},
122
+ }
123
+
124
+ ```
125
+
126
+ ## License
127
+
128
+ The `Aira-Instruct-PT-560M` is licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for more details.