NeMo
PyTorch
English
Hindi
nemotron
ravirajoshi commited on
Commit
9be4968
1 Parent(s): c81dd10

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +129 -6
README.md CHANGED
@@ -1,6 +1,129 @@
1
- ---
2
- license: other
3
- license_name: nvidia-open-model-license
4
- license_link: >-
5
- https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf
6
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: nvidia-open-model-license
4
+ license_link: >-
5
+ https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf
6
+ language:
7
+ - en
8
+ - hi
9
+ base_model: nvidia/Nemotron-4-Mini-Hindi-4B-Base
10
+ library_name: nemo
11
+ ---
12
+ # Nemotron-4-Mini-Hindi-4B-Instruct
13
+
14
+ ## Model Overview
15
+
16
+ Nemotron-4-Mini-Hindi-4B-Instruct is a model for generating responses to questions grounded in the Indian context. It supports queries in Hindi, English, and Hinglish. It is a small language model (SLM) which is fine-tuned/aligned version of [nvidia/Nemotron-4-Mini-Hindi-4B-Base]https://huggingface.co/nvidia/Nemotron-4-Mini-Hindi-4B-Base), which was continuously pre-trained on top of Nemotron-Mini-4B-Base/Minitron-4B-Base. It supports a context length of 4,096 tokens. This model is ready for commercial use.
17
+
18
+ Try this model on [build.nvidia.com](https://build.nvidia.com/nvidia/nemotron-4-mini-hindi-4b-instruct).
19
+
20
+ For more details about how this model is used for [NVIDIA ACE](https://developer.nvidia.com/ace), please refer to [this blog post](https://developer.nvidia.com/blog/deploy-the-first-on-device-small-language-model-for-improved-game-character-roleplay/) and [this demo video](https://www.youtube.com/watch?v=d5z7oIXhVqg), which showcases how the model can be integrated into a video game. You can download the model checkpoint for NVIDIA AI Inference Manager (AIM) SDK from [here](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/ucs-ms/resources/nemotron-mini-4b-instruct).
21
+
22
+ **Model Developer:** NVIDIA
23
+
24
+ **Model Dates:** Nemotron-4-Mini-Hindi-4B-Instruct was trained between June 2024 and Oct 2024.
25
+
26
+ ## License
27
+
28
+ [NVIDIA Community Model License](https://huggingface.co/nvidia/Nemotron-4-Mini-Hindi-4B-Instruct/blob/main/nvidia-community-model-license-aug2024.pdf)
29
+
30
+ ## Model Architecture
31
+
32
+ /Nemotron-4-Mini-Hindi-4B-Instruct uses a model embedding size of 3072, 32 attention heads, and an MLP intermediate dimension of 9216. It also uses Grouped-Query Attention (GQA) and Rotary Position Embeddings (RoPE).
33
+
34
+ **Architecture Type:** Transformer Decoder (auto-regressive language model)
35
+
36
+ **Network Architecture:** Nemotron-4
37
+
38
+
39
+ ## Prompt Format:
40
+
41
+ We recommend using the following prompt template, which was used to fine-tune the model. The model may not perform optimally without it.
42
+
43
+ **Single Turn**
44
+
45
+ ```
46
+ <extra_id_0>System
47
+ {system prompt}
48
+
49
+ <extra_id_1>User
50
+ {prompt}
51
+ <extra_id_1>Assistant\n
52
+ ```
53
+ Note that a newline character \n should be added at the end of the prompt.
54
+ We recommend using <extra_id_1> as a stop token.
55
+
56
+ ## Usage
57
+
58
+ ```
59
+ from transformers import AutoTokenizer, AutoModelForCausalLM
60
+
61
+ # Load the tokenizer and model
62
+ tokenizer = AutoTokenizer.from_pretrained("nvidia/Nemotron-4-Mini-Hindi-4B-Instruct")
63
+ model = AutoModelForCausalLM.from_pretrained("nvidia/Nemotron-4-Mini-Hindi-4B-Instruct")
64
+
65
+ # Use the prompt template
66
+ messages = [
67
+
68
+ {"role": "user", "content": "भारत की संस्कृति के बारे में बताएं।"},
69
+ ]
70
+ tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
71
+
72
+ outputs = model.generate(tokenized_chat, max_new_tokens=128)
73
+ print(tokenizer.decode(outputs[0]))
74
+ ```
75
+
76
+ You can also use `pipeline` but you need to create a tokenizer object and assign it to the pipeline manually.
77
+
78
+ ```
79
+ from transformers import AutoTokenizer
80
+ from transformers import pipeline
81
+
82
+ tokenizer = AutoTokenizer.from_pretrained("nvidia/Nemotron-4-Mini-Hindi-4B-Instruct")
83
+
84
+ messages = [
85
+ {"role": "user", "content": "भारत की संस्कृति के बारे में बताएं।"},
86
+ ]
87
+ pipe = pipeline("text-generation", model="nvidia/Nemotron-4-Mini-Hindi-4B-Instruct")
88
+ pipe.tokenizer = tokenizer # You need to assign tokenizer manually
89
+ pipe(messages)
90
+ ```
91
+ ## Evaluation Results
92
+
93
+ *Zero-shot performance.* Evaluated using select datasets from the [IndicInstruct](https://github.com/AI4Bharat/IndicInstruct) with additions:
94
+
95
+ | MMLU | ARC-C | ARC-E | HellaSwag | BoolQ | IndicQuest (GPT4-Turbo)
96
+ | :------------- | :------------- | :------------- | :------------- | :------------- | :------------- |
97
+ | 50.5 | 65.53 | 79.97 | 39.9 | 67.86 | 4.15 |
98
+
99
+
100
+ Please refer to our [paper](https://arxiv.org/abs/2410.14815) for the full set of results.
101
+
102
+ ## Inference
103
+ **Engine:** TensorRT-LLM
104
+
105
+ **Test Hardware:** NVIDIA A100
106
+
107
+ **DType:** Float16/BFloat16
108
+
109
+
110
+ ## AI Safety Efforts
111
+
112
+ The Nemotron-4-Mini-Hindi-4B-Instruct model underwent AI safety evaluation including adversarial testing via three distinct methods:
113
+ - [Garak](https://github.com/leondz/garak), is an automated LLM vulnerability scanner that probes for common weaknesses, including prompt injection and data leakage.
114
+ - [AEGIS](https://huggingface.co/datasets/nvidia/Aegis-AI-Content-Safety-Dataset-1.0), is a content safety evaluation dataset and LLM based content safety classifier model, that adheres to a broad taxonomy of 13 categories of critical risks in human-LLM interactions.
115
+ - Human Content Red Teaming leveraging human interaction and evaluation of the models' responses.
116
+
117
+
118
+ ## Limitations
119
+
120
+ The model was trained on data that contains toxic language and societal biases originally crawled from the internet. Therefore, the model may amplify those biases and return toxic responses especially when prompted with toxic prompts. The model may generate answers that may be inaccurate, omit key information, or include irrelevant or redundant text producing socially unacceptable or undesirable text, even if the prompt itself does not include anything explicitly offensive. The model may answer with I statements, exhibiting some anthropomorphizing. This issue could be exacerbated without the use of the recommended prompt template.
121
+
122
+
123
+ ## Ethical Considerations
124
+
125
+ NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse. For more detailed information on ethical considerations for this model, please see the [Model Card++](https://build.nvidia.com/nvidia/nemotron-4-mini-hindi-4b-instruct/modelcard). Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
126
+
127
+
128
+
129
+