Welcome to this comprehensive guide on the Jais Family of models, a revolutionary series of bilingual English-Arabic large language models (LLMs). Designed by Inception and Cerebras Systems, these models aim to improve Arabic NLP and are geared for various applications serving the Arabic-speaking and bilingual communities.
Getting Started with Jais Models
The Jais family provides extensive combinations of pre-trained and fine-tuned models, each with unique configurations and capabilities:
- Pre-trained from scratch: Models labeled as
jais-family-*. - Pre-trained adaptively: Models derived from Llama-2 labeled as
jais-adapted-*.
Exploring the Model Sizes
You can utilize models ranging from 590M to a whopping 70B parameters, trained on a diverse corpus of up to 1.6 trillion tokens. Here’s a taste of what the Jais family offers:
- jais-family-30b-16k: Pre-trained (30B parameters) with 16,384 tokens context length
- jais-adapted-70b: Adapted from Llama-2 (70B parameters)
How to Use the Jais Models
Let’s go through how you can get started with the Jais models using Python. Imagine you are a chef, and each ingredient (code) adds a unique flavor (functionality) to the dish (your model). Here’s how to prepare your model:
# Import necessary libraries
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# Specify the model path
model_path = "inceptionai/jais-adapted-13b-chat"
# Create a prompt in English
prompt_eng = "### Instruction: Your name is 'Jais'..."
# Check device
device = "cuda" if torch.cuda.is_available() else "cpu"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto", trust_remote_code=True)
# Set pad token if needed
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
# Generate a response function
def get_response(text, tokenizer=tokenizer, model=model):
tokenized = tokenizer(text, return_tensors="pt")
input_ids, attention_mask = tokenized['input_ids'].to(device), tokenized['attention_mask'].to(device)
generate_ids = model.generate(input_ids, attention_mask=attention_mask, top_p=0.9, temperature=0.3, max_length=2048)
response = tokenizer.decode(generate_ids[0], skip_special_tokens=True)
return response
# Sample queries
eng_ques = "What is the capital of UAE?"
print(get_response(prompt_eng.format(Question=eng_ques)))
arabic_ques = "ما هي عاصمة الامارات؟"
print(get_response(prompt_ar.format(Question=arabic_ques)))
In the analogy, the Python code is like the recipe instruction for preparing a meal. You gather the ingredients (import libraries), prepare the cooking setup (load tokenizer and model), and then follow the instructions (function) to serve a delightful dish (model response).
Troubleshooting Tips
If you encounter issues, here are some troubleshooting steps:
- Model not loading: Ensure you’re using the
trust_remote_code=Trueoption when calling the model. - Performance issues: Check if you have CUDA enabled for faster processing. You might need to install the necessary GPU drivers.
- Token padding problems: Always set the
pad_tokento avoid errors during inference.
If the problems persist, ensure you have the correct versions of the libraries and model paths. For detailed assistance, consider visiting the support forums related to Transformers for potential fixes.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
The Jais family holds immense potential for researchers and developers looking to harness the capabilities of large language models in both Arabic and English. By following this guide, you are well-prepared to unleash the power of bilingual AI in your projects.

