Jais-13b

This is a 13 billion parameter pre-trained bilingual large language model for both Arabic and English, trained on a dataset containing 72 billion Arabic tokens and 279 billion English/code tokens. The Arabic data is iterated over for 1.6 epochs (as opposed to 1 epoch for English/code), for a total of 395 billion tokens of training.

The model is based on transformer-based decoder-only (GPT-3) architecture and uses SwiGLU non-linearity. It implements ALiBi position embeddings, enabling the model to extrapolate to long sequence lengths, providing improved context handling and model precision.
Getting started

Below is sample code to use the model. Note that the model requires a custom model class, so users must enable trust_remote_code=True while loading the model. Also, note that this code is tested on transformers==4.28.0.

# -*- coding: utf-8 -*-

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_path = "inception-mbzuai/jais-13b"

device = "cuda" if torch.cuda.is_available() else "cpu"

tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto", trust_remote_code=True)


def get_response(text,tokenizer=tokenizer,model=model):
    input_ids = tokenizer(text, return_tensors="pt").input_ids
    inputs = input_ids.to(device)
    input_len = inputs.shape[-1]
    generate_ids = model.generate(
        inputs,
        top_p=0.9,
        temperature=0.3,
        max_length=200-input_len,
        min_length=input_len + 4,
        repetition_penalty=1.2,
        do_sample=True,
    )
    response = tokenizer.batch_decode(
        generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True
    )[0]
    return response


text= "عاصمة دولة الإمارات العربية المتحدة ه"
print(get_response(text))

text = "The capital of UAE is"
print(get_response(text))

Model Details

    Developed by: Inception, Mohamed bin Zayed University of Artificial Intelligence (MBZUAI), and Cerebras Systems.
    Language(s) (NLP): Arabic and English
    License: Apache 2.0
    Input: Text only data.
    Output: Model generates text.
    Paper : Jais and Jais-chat: Arabic-Centric Foundation and Instruction-Tuned Open Generative Large Language Models
    Demo : Access here

Intended Use

We release the Jais 13B model under a full open source license. We welcome all feedback and opportunities to collaborate.

This model is the first release from the Inception - MBZUAI - Cerebras parternship, and at the time of release, achieved state of the art across a comprehensive Arabic test suite as described in the accompanying technical report. Some potential downstream uses include:

    Research: This model can be used by researchers and developers.
    Commercial Use: It can be used as a base model to further fine-tune for specific use cases (similar to jais-13b-chat). Some potential use cases include:
        Chat-assistants.
        Customer service.

Audiences that we hope will benefit from our model:

    Academics: For those researching Arabic natural language processing.
    Businesses: Companies targeting Arabic-speaking audiences.
    Developers: Those integrating Arabic language capabilities in apps.