Exnrt Logo
  • Home
  • Technology
    • Artificial Intelligence
    • WordPress
  • Programming
    ProgrammingShow More
    Mistral AI Model
    Mistral-7B Instruct Fine-Tuning using Transformers LoRa
    19 1
    Hugging Face Website
    Hugging Face Transformers Pipeline, what can they do?
    15 1
    AI generated images using SDXL-Lightning huggingface
    SDXL-Lightning model using hugging face Transformers
    14 1
    Gemma AI Model
    Finetune Gemma Models with Transformers
    11 1
    HTML Quiz App
    Quiz App Using HTML, CSS, and JavaScript
    9 1
  • Business
    • Ads
    • SEO
  • AI Tools
    • AI Chatbot For Education
    • Ask a Question
    • News Title Generator
  • My Feed
    • My Interests
    • My Saves
    • History
Notification
Sign In
ExnrtExnrtExnrt
Font ResizerAa
  • Artificial Intelligence
  • Technology
  • Business
  • Ads
  • SEO
Search
  • Blog
  • Ads
  • Programming
  • Technology
  • Artificial Intelligence
  • WordPress
  • SEO
  • Business
  • Education

Top Stories

Explore the latest updated news!
Fine Tuning Siglip2 a ViT on Image Classification Task.

Fine Tuning Siglip2 on Image Classification Task

6
AI-Generated-Image-using-Flux-1

How to Fine-Tune Flux.1 Using AI Toolkit

8
microsoft/Phi-3-mini-128k-instruct

How to fine-tune Microsoft/Phi-3-mini-128k-instruct

12

Stay Connected

Find us on socials
248.1k Followers Like
61.1k Followers Follow
165k Subscribers Subscribe
Artificial IntelligenceBlog

DBRX-Instruct: A step-by-step guide to use

DBRX is the next model poised to take the 'best open model' crown from Mixtral. It beats Grok-1 in several benchmark tests as well.
Ateeq Azam
Last updated: March 28, 2024 10:50 pm
By Ateeq Azam Add a Comment 11 1
Share
dbrx benchmark tests
dbrx benchmark tests
SHARE

Databricks released DBRX, an open, general-purpose LLM that outperforms other available open-source models on various benchmark tests. The model weights are available on hugging Face and GitHub for research as well as for commercial purposes.

Table of Content
DBRX Base and DBRX-InstructA New State-of-the-Art Open LLMComparison with other ModelsQuickstart GuideRun the model on a CPU:Run the model on multiple GPUs:Limitations and Ethical ConsiderationsTraining Dataset LimitationsAssociated Risks and Recommendations

DBRX Base and DBRX-Instruct

DBRX-Base and DBRX-Instruct are the latest open-source Mixture-of-Experts (MoE) models with 36B active and 132B Total Parameters. Both the base version (DBRX Base) and the fine-tuned version (DBRX Instruct) of DBRX are trained from stretch and can be executed or optimized on public, custom, or proprietary datasets.

FeatureDBRX BaseDBRX Instruct
Model TypeFoundation ModelPre-trained model for specific tasks
CustomizabilityHighly customizable for specific applicationsPre-programmed for following instructions and tasks
PurposeBlank canvas for building specialized AI appsDesigned for tasks like question answering, summarization, creative writing, and coding assistance
Fine-TuningRequires fine-tuning for specific tasksPre-trained for few-turn interactions and task completion
UsageFlexible across a range of applicationsSpecifically optimized for tasks within a conversation
SpecializationGeneral-purpose, adaptableTask-specific, optimized for instruction following

A New State-of-the-Art Open LLM

DBRX outperforms models such as LLaMA2-70B, Mixtral, and Grok-1 in language comprehension, programming, math, and logic tasks. The model has been identified by Databricks’ Gauntlet, an open-source benchmarking tool, to excel in over 30 advanced benchmarks, indicating ongoing enhancements to model quality.

In terms of efficiency and control, DBRX is the preferred choice for enterprises replacing proprietary models with open-source alternatives, as it outperforms GPT-3.5 in most tests. Databricks has observed this pattern among its 12,000+ client base, with many achieving higher quality and speed by customizing open-source models to their specific requirements.

Here are the key points about DBRX:

  • Model Type: Utilizes a mixture-of-experts (MoE) architecture with 132B total, 36B active parameters.
  • Model Base:  It’s transformer-based decoder-only that was trained using next-token prediction. 
  • Training Data: Trained on 12 trillion tokens.
  • Context Length: Supports a maximum context length of 32k tokens.
  • Licensing: Follows a Llama-like license, with non-commercial terms allowing up to 700 million users and prohibiting training on outputs.
  • Fine-Tuning: While details on fine-tuning are currently lacking, the Instruct model is pre-tuned for specific tasks, and it’s unclear whether reinforcement learning from human feedback (RLHF) was used.
  • Estimated Cost: Estimated to cost $10-30 million, involving significant resources such as focused time, hardware, engineering efforts, and data contracts.

Comparison with other Models

ModelMMLUGSM8KHumanEval
GPT-486.49267
Llama2-70B69.854.423.7
Mixtral-8x7B-base70.674.440.2
Qwen1.5-72B77.579.541.5
DBRX-4x33B-instruct73.766.970.1

Quickstart Guide

Note: Manual approval is required to access the Base model.

Transformers library makes it simple to start working with DBRX models. The following packages and approximately 264GB of RAM are needed for this model:

! pip install transformers tiktoken

The hf_transfer package, as described by Huggingface, can be utilized to enhance download speed.

pip install hf_transfer
export HF_HUB_ENABLE_HF_TRANSFER=1

To download the model, you will have to submit a request for access to this repository. After this is approved, provide the following token and receive an access token with read permission.

or

# Or requirements-gpu.txt to use flash attention on GPU(s)
pip install -r requirements.txt
# Add your Hugging Face token in order to access the model
huggingface-cli login
# See generate.py to change the prompt and other settings
python generate.py

The requirements and generate.py file are available on GitHub repository here.

DBRX GitHub Repository
DBRX GitHub Repository

Run the model on a CPU:

Import necessary libraries:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
  • Load the tokenizer and model
  • Replace “hf_YOUR_TOKEN” with your actual Hugging Face token
tokenizer = AutoTokenizer.from_pretrained("databricks/dbrx-instruct", trust_remote_code=True, token="hf_YOUR_TOKEN")
model = AutoModelForCausalLM.from_pretrained("databricks/dbrx-instruct", 
                                          device_map="cpu",  # Use CPU for inference
                                          torch_dtype=torch.bfloat16,  # Use BFloat16 for efficient memory usage
                                          trust_remote_code=True, 
                                          token="hf_YOUR_TOKEN")
# Prepare the input text
input_text = "How to Fine-tune LLM?"

# Format the input as a chat message
messages = [{"role": "user", "content": input_text}]

# Apply the chat template and tokenize the input
input_ids = tokenizer.apply_chat_template(messages, 
                                          return_dict=True,
                                          tokenize=True,
                                          add_generation_prompt=True,
                                          return_tensors="pt")

# To generate up to 200 new tokens
outputs = model.generate(**input_ids, max_new_tokens=200)

# Decode the generated text & Print
print(tokenizer.decode(outputs[0]))

Run the model on multiple GPUs:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("databricks/dbrx-instruct", trust_remote_code=True, token="hf_YOUR_TOKEN")
model = AutoModelForCausalLM.from_pretrained("databricks/dbrx-instruct", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True, token="hf_YOUR_TOKEN")

input_text = "What is Fine-tuning?"
messages = [{"role": "user", "content": input_text}]
input_ids = tokenizer.apply_chat_template(messages, return_dict=True, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=200)
print(tokenizer.decode(outputs[0]))

If your GPU system supports FlashAttention2, you can add attn_implementation=”flash_attention_2” as a keyword to AutoModelForCausalLM.from_pretrained() to achieve faster inference.

Limitations and Ethical Considerations

Training Dataset Limitations

With a December 2023 knowledge cutoff, DBRX models were trained using 12T text tokens.

DBRX use a mixture of code and language examples in its training dataset. The most of the training text consists of English-language. However, DBRX’s proficiency in non-English languages has not been tested. Therefore, DBRX should be considered a generalist model for text-based tasks in English language. It does not have multimodal capabilities.

Associated Risks and Recommendations

Certainly, here are minor adjustments to your text:

All foundation models are cutting-edge technologies with a range of dangers and the potential to produce biased, offensive, incomplete, or erroneous information. Before utilizing or sharing such output, users should use caution and assess whether it is accurate and suitable for the use case they have in mind.

Retrieval augmented generation, or RAG, is advised by Databricks for situations where precision and authenticity are crucial. Additionally, i advise anyone utilizing or refining DBRX Base or DBRX Instruct to conduct extra safety testing within the parameters of their specific application and area.

TAGGED:Artificial IntelligenceGitHubHugging FaceProgramming
Share This Article
Facebook Twitter Copy Link Print
What do you think?
Love4
Sad0
Happy0
Sleepy0
Angry0
Leave a comment
Subscribe
Login
Notify of
guest

guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

You Might Also Like

Fine Tuning Siglip2 a ViT on Image Classification Task.
Fine Tuning Siglip2 on Image Classification Task
AI-Generated-Image-using-Flux-1
How to Fine-Tune Flux.1 Using AI Toolkit
microsoft/Phi-3-mini-128k-instruct
How to fine-tune Microsoft/Phi-3-mini-128k-instruct
AI Generated: A professional real llama looking like a hacker in a dark lab with light yellow lights
How to Fine-tune Meta Llama-3 8B

Other Posts

Google Ads
AdSense for Search excludes subdomains from March 13, 2024
Ads Blog
xAI grok-1 open-weights model
Get started with the open-source Grok-1 model
Artificial Intelligence Blog
Text Particles Using JavaScript
Text Particles in Motion with Cursor Interaction Using JS
Programming Blog
diDNA AdX
diDNA AdX: Website Maximization for Publishers
Ads Blog

Latest Posts

Uncover the Latest stories that related to your interest!
Fine Tuning Siglip2 a ViT on Image Classification Task.
Artificial IntelligenceBlog

Fine Tuning Siglip2 on Image Classification Task

April 14, 2025

At Exnrt.com, we believe in empowering computer science students with the knowledge and skills they need to succeed in their careers. Our goal is to provide accessible and engaging tutorials that help students and professionals develop their skills and advance their careers.

  • Categories:
  • Business
  • Technology
  • Ads
  • SEO

Quick Links

  • Blog
  • Technology
  • Artificial Intelligence
  • Business

About US

  • About Us
  • Contact Us
  • Privacy Policy

Copyright © 2024 All Rights Reserved – Exnrt by ateeq.pk

wpDiscuz
Welcome Back!

Sign in to your account

Register Lost your password?