If you’ve been looking into developing AI applications in Bahasa Indonesia, the Nusantara model is your go-to solution! Utilizing a series of Open Weight Language Models, Nusantara can help you with tasks like question answering and instruction following.
What is Nusantara?
Nusantara is crafted from the Qwen1.5 language model and fine-tuned on specific datasets, providing around five variants with different performance levels: 0.8B, 1.8B, 2.7B, 4B, and 7B models available. This means, depending on your requirements, you can choose the model that best suits your needs!
Getting Started with the Model
To efficiently use the Nusantara model, you need to have some fundamental code in place. Think of it as preparing a delicious recipe—you need to gather all your ingredients (in this case, code and libraries) before you start cooking!
Code Snippet to Load the Model
Here’s a handy code snippet to get you started:
from transformers import AutoModelForCausalLM, AutoTokenizer
device = cuda # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained(
"kalisai/Nusantara-7B-Indo-Chat",
torch_dtype=auto,
device_map=auto
)
tokenizer = AutoTokenizer.from_pretrained("kalisai/Nusantara-7B-Indo-Chat")
prompt = "Berikan saya resep memasak nasi goreng yang lezat."
messages = [
{"role": "system", "content": "Kamu adalah Nusantara, asisten AI yang pintar."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors=pt).to(device)
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Understanding the Code
Let’s break it down:
- Importing Libraries: Like selecting the finest ingredients for a dish, you’re importing necessary libraries to handle the data smoothly.
- Loading the Model: Just as you would preheat your oven for perfect cooking, this step involves loading the model into the right environment (device).
- Setting Up the Prompt: Your prompt is the recipe you want to prepare—here, it is an Indonesian dish: nasi goreng.
- Generating Response: After cooking up your input, the model generates a response just like a finished dish, ready to be tasted!
Troubleshooting
Here are some common issues you might face:
- Error Loading Model: Make sure the model names are correctly spelled and you have access to them.
- Device Compatibility: Ensure that your device supports the necessary configurations (like CUDA for GPU acceleration).
- Memory Issues: If you run out of memory, consider using a smaller model variant.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Important Considerations
It’s crucial to be aware of the biases and limitations that arise from using the model. Since it was trained with uncensored data, some negative impacts are possible. Therefore, the responsibility of usage lies solely with you, the user.
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.
Final Thoughts
With the right approach, the Nusantara language model can open doors to exciting AI possibilities in Bahasa Indonesia. Start experimenting today, and don’t hesitate to share your findings with the community!

