Abhishekcr448 commited on
Commit
37be3e0
·
verified ·
1 Parent(s): 4a86d29

Updated Readme

Browse files
Files changed (1) hide show
  1. README.md +149 -3
README.md CHANGED
@@ -1,3 +1,149 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - Abhishekcr448/Hinglish-Everyday-Conversations
5
+ language:
6
+ - en
7
+ tags:
8
+ - Tiny
9
+ - Hinglish
10
+ - Chat
11
+ - Everyday
12
+ - Conversations
13
+ - small
14
+ - text-generation-inference
15
+ - text-completion
16
+ ---
17
+ # Model Card for Tiny Hinglish-Chat-21M
18
+
19
+ A Tiny Hinglish Speaking text completion model. It can carry out conversations on everyday-life topics in Hinglish. Try it now through its Hugging Face Space!
20
+
21
+ ## Model Details
22
+
23
+ ### Model Description
24
+
25
+ The **Tiny Hinglish-Chat-21M** is a small conversational text generation model trained on a Hinglish-based conversation dataset. It can generate responses in Hinglish (a mixture of Hindi and English) for everyday conversation topics. The model is based on the GPT-2 architecture, making it suitable for text completion tasks in a conversational setting.
26
+
27
+ The model was trained using a synthetically created Hinglish dataset with GPT4o-mini and fine-tuned to provide responses that mimic casual dialogues between two people. This model is designed for edge devices, ensuring it remains lightweight and fast while maintaining response relevance.
28
+
29
+ The complete process and code used to build this model can be found in my GitHub repository: [Tiny-Hinglish-Chat-21M-Scripts](https://github.com/Abhishekcr448/Tiny-Hinglish-Chat-21M-Scripts)
30
+
31
+ - **Developed by:** [Abhishek Khatri](https://huggingface.co/Abhishekcr448)
32
+ - **Model Type:** Text-to-Text Generation (Conversational AI)
33
+ - **License:** MIT
34
+
35
+ ### Model Architecture
36
+
37
+ This model is built on the GPT-2 architecture, a well-known transformer-based model designed for generating coherent text in a variety of contexts. The model was fine-tuned on a dataset of Hinglish conversations, ensuring it understands both Hindi and English mixed text.
38
+
39
+ ### Performance
40
+
41
+ - **Language Support:** Hinglish (a mix of Hindi and English)
42
+ - **Primary Use Case:** Text completion for conversational chatbots
43
+ - **Model Size:** ~21 million parameters
44
+
45
+ ## Uses
46
+
47
+ This model can be used for generating text in Hinglish, making it ideal for small-scale chatbots or applications that need conversational models with limited computational resources. It is particularly suitable for edge devices where both the model size and response time matter.
48
+
49
+ ### Direct Use
50
+
51
+ You can directly use the model through Hugging Face's Space or by integrating it into your own application. Currently, there is no live implementation available, but you can easily implement it for use in chatbots or conversational systems.
52
+
53
+ ## Bias, Risks, and Limitations
54
+
55
+ Like any AI model, this model may sometimes generate irrelevant or biased outputs. Since it was trained on synthetic data generated by GPT4o-mini, there may be instances where the outputs reflect the biases inherent in that data. Users should always review generated text to ensure its relevance and appropriateness.
56
+
57
+ ### Risks
58
+
59
+ - The model may sometimes provide contextually incorrect or biased responses.
60
+ - Hinglish being a non-standard language mixture, some responses may be difficult for users unfamiliar with the language blend.
61
+
62
+ ### Recommendations
63
+
64
+ It is advised to monitor and review the generated outputs before deployment, especially in sensitive applications, to avoid any undesirable or inappropriate responses.
65
+
66
+ ## How to Get Started with the Model
67
+
68
+ To get started with the model, simply run the below python code
69
+
70
+ ```python
71
+ import torch
72
+ from transformers import AutoTokenizer, AutoModelForCausalLM
73
+
74
+ # Load the model and tokenizer
75
+ model, tokenizer = (AutoModelForCausalLM.from_pretrained("Abhishekcr448/Tiny-Hinglish-Chat-21M")
76
+ .to("cuda" if torch.cuda.is_available() else "cpu"),
77
+ AutoTokenizer.from_pretrained("Abhishekcr448/Tiny-Hinglish-Chat-21M"))
78
+
79
+ # Function to generate text
80
+ def generate_text(prompt):
81
+ inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
82
+ print(tokenizer.decode(model.generate(inputs['input_ids'],
83
+ max_length=inputs['input_ids'].shape[-1] + 25,
84
+ no_repeat_ngram_size=2, temperature=0.8,
85
+ top_k=50, top_p=0.9, do_sample=True)[0],
86
+ skip_special_tokens=True))
87
+
88
+ while (prompt := input("Enter prompt ('exit' to quit): ").lower()) != "exit":
89
+ generate_text(prompt)
90
+ ```
91
+
92
+ ## Training Details
93
+
94
+ The training process, including data collection, preprocessing, and model fine-tuning, is explained in the following GitHub repository: [Tiny-Hinglish-Chat-21M-Scripts](https://github.com/Abhishekcr448/Tiny-Hinglish-Chat-21M). The model was trained on a custom Hinglish dataset created using GPT4o-mini.
95
+
96
+
97
+ ## Environmental Impact
98
+
99
+ The model was trained on a private infrastructure using an NVIDIA RTX 4090 GPU, and the total computation lasted for about 10 hours. The carbon emissions during the training were calculated using the Machine Learning CO₂ Impact calculator.
100
+
101
+ Hardware Type: RTX 4090
102
+ Hours used: ~10 hours
103
+ Cloud Provider: Vast.ai
104
+ Compute Region: Germany
105
+ Carbon Emitted: 1.3 kg CO₂ (estimated)
106
+ These values were calculated using the MLCO2 Impact Calculator presented in the paper by Lacoste et al. (2019).
107
+
108
+ ## Technical Specifications
109
+
110
+ ### Model Architecture and Objective
111
+
112
+ **Architecture**: GPT-2 (small model)
113
+ **Objective**: Text generation based on conversational prompts in Hinglish
114
+
115
+ ### Software
116
+
117
+ **Frameworks Used**: PyTorch, Transformers (Hugging Face)
118
+ **Environment**: Python 3.8, torch 2.5.1, transformers 4.46.3
119
+
120
+ ## Citation
121
+
122
+ If you use this model or dataset in your work, please cite the following:
123
+
124
+ **BibTeX:**
125
+ ```
126
+ @misc{Tiny-Hinglish-Chat-21M,
127
+ author = {Abhishek Khatri},
128
+ title = {Tiny Hinglish-Chat-21M: A Small Hinglish Conversational Model},
129
+ year = {2024},
130
+ url = {https://huggingface.co/Abhishekcr448/Tiny-Hinglish-Chat-21M},
131
+ }
132
+ ```
133
+
134
+ **APA:**
135
+
136
+ Khatri, A. (2024). Tiny Hinglish-Chat-21M: A Small Hinglish Conversational Model. Retrieved from https://huggingface.co/Abhishekcr448/Tiny-Hinglish-Chat-21M
137
+
138
+ ## Glossary
139
+
140
+ **Hinglish**: A blend of Hindi and English, widely used in everyday communication in India and surrounding regions. It involves mixing the two languages, often within the same sentence.
141
+ **GPT-2**: A transformer-based language model for text generation developed by OpenAI.
142
+
143
+ ## More Information [optional]
144
+
145
+ For more information about this model, its training process, or related resources, you can check the GitHub repository [Tiny-Hinglish-Chat-21M-Scripts](https://github.com/Abhishekcr448/Tiny-Hinglish-Chat-21M).
146
+
147
+ ## Model Card Authors [optional]
148
+
149
+ **Author**: Abhishek Khatri