Update README.md
Browse files
README.md
CHANGED
@@ -267,76 +267,6 @@ The weather in Jerusalem is currently 18 degrees Celsius. In London, it is 8 deg
|
|
267 |
|
268 |
</details>
|
269 |
|
270 |
-
## Grounded Generation with Jamba:
|
271 |
-
|
272 |
-
A common use-case for LLMs is grounded generation and RAG, where the model is required to answer a question or follow an instruction based on a given set of documents or document snippets. To standardize this process, Jamba was trained with a specific "documents" section in its chat template. The model was trained to attend to this section, and grounded generation tasks show improved performance when the task is formatted in this way.
|
273 |
-
|
274 |
-
Similar to tools, which are given as an external argument to the model in addition to the conversation, documents are provided in a similar way. To support document-level metadata, a document is defined as a dictionary with key-values of your choosing. These are formatted within the chat template. Two keys that get special treatment are "title", which is formatted at the top of the document if present, and "text" which is a required field and defines the actual text of the document.
|
275 |
-
|
276 |
-
<details><summary><strong>Ataching documents to Jamba Mini 1.6 prompt</strong></summary>
|
277 |
-
|
278 |
-
```python
|
279 |
-
from transformers import AutoTokenizer
|
280 |
-
|
281 |
-
tokenizer = AutoTokenizer.from_pretrained("ai21labs/AI21-Jamba-Mini-1.6")
|
282 |
-
|
283 |
-
messages = [
|
284 |
-
{
|
285 |
-
"role": "user",
|
286 |
-
"content": "Who wrote Harry Potter?"
|
287 |
-
}
|
288 |
-
]
|
289 |
-
|
290 |
-
documents = [
|
291 |
-
{
|
292 |
-
"text": "Harry Potter is a series of seven fantasy novels written by British author J. K. Rowling.",
|
293 |
-
"title": "Harry Potter"
|
294 |
-
},
|
295 |
-
{
|
296 |
-
"text": "The Great Gatsby is a novel by American writer F. Scott Fitzgerald.",
|
297 |
-
"title": "The Great Gatsby",
|
298 |
-
"country": "United States",
|
299 |
-
"genre": "Novel"
|
300 |
-
|
301 |
-
}
|
302 |
-
]
|
303 |
-
|
304 |
-
prompt = tokenizer.apply_chat_template(
|
305 |
-
messages,
|
306 |
-
documents=documents,
|
307 |
-
tokenize=False,
|
308 |
-
)
|
309 |
-
|
310 |
-
# Output: J. K. Rowling
|
311 |
-
|
312 |
-
```
|
313 |
-
|
314 |
-
</details>
|
315 |
-
|
316 |
-
## JSON mode
|
317 |
-
Jamba 1.6 was trained with specific “knobs”, which help steer the model towards commonly requested behaviors. Each behavior is enabled by including specific pre-defined text in the system message. For ease of use, we've included them as flags in Jamba 1.6's chat template, so they can be toggled by passing appropriate arguments to the chat template.
|
318 |
-
|
319 |
-
Jamba 1.6 was trained to produce valid JSONs when requested to. It does so naturally, but when the JSON mode knob is activated the likelihood of a valid json increases considerably. In JSON mode, Jamba 1.6 will attempt to output a valid JSON regardless of the user request. However, it is highly recommended to specify information about the expected json schema in the user request or system message to get the best results, as shown in the example below.
|
320 |
-
|
321 |
-
<details><summary><strong>Usage of JSON knob in Jamba 1.6</strong></summary>
|
322 |
-
|
323 |
-
```python
|
324 |
-
from transformers import AutoTokenizer
|
325 |
-
|
326 |
-
tokenizer = AutoTokenizer.from_pretrained("ai21labs/AI21-Jamba-Mini-1.6")
|
327 |
-
messages = [
|
328 |
-
{'role':'user',
|
329 |
-
'content':'Describe the first American president. Include year of birth (number) and name (string).'}
|
330 |
-
]
|
331 |
-
prompt = tokenizer.apply_chat_template(messages,
|
332 |
-
tokenize=False,
|
333 |
-
add_generation_prompt=False,
|
334 |
-
|
335 |
-
#Output: "{ "year of birth": 1732, "name": "George Washington." }"
|
336 |
-
```
|
337 |
-
|
338 |
-
</details>
|
339 |
-
|
340 |
|
341 |
## Fine-tuning examples
|
342 |
|
|
|
267 |
|
268 |
</details>
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
## Fine-tuning examples
|
272 |
|