Back to All
Project

SLM Model Compilation and Integration on Qualcomm® Robotics RB5

The rapid advancement of Artificial Intelligence and Machine Learning has paved the way for sophisticated conversational agents capable of understanding and responding to human language. This project focuses on leveraging the Google T5-Small model, a powerful transformer-based model, for inference tasks on the Qualcomm® Robotics RB5 platform. The primary objective is to create a voice-enabled chatbot tailored to handle queries related to Qualcomm® technologies and services.

Objective

Deploy the Google T5-Small model on Qualcomm Robotics RB5 to develop a voice-enabled chatbot specialized in responding to queries about Qualcomm technologies and services, utilizing its advanced AI capabilities for efficient inference tasks. This model avoids the complexities associated with running larger language models (LLMs) on embedded platforms.

 

 

Equipment Description
Qualcomm Robotics RB5 Qualcomm Robotics RB5 Development Kit
USB to Micro USB cable 
USB to USB Type C cable
For serial console interface , to view logs
For connecting the USB3.0 Type C port to the board and flashing images, adb and fastboot
Power adapter 12 V with 2500 mA required by the 96Boards specification

Model Training:

The Google T5-Small model will be fine-tuned using a dataset specific to Qualcomm Technologies. This dataset will include various queries and responses pertinent to Qualcomm® technologies, products, and services. The fine-tuning process will enhance the model’s ability to generate more accurate and contextually relevant responses.

Voice Command Integration:

To facilitate superior interaction, the chatbot will be equipped with voice recognition capabilities. Users will be able to input queries through voice commands, which will be converted to text for processing by the T5-Small model.

Inference and Response Generation:

The T5-Small model will perform inference on the input text, generating appropriate responses. This step utilizes the model's pre-trained language understanding and generation capabilities, fine-tuned for the specific use case.

Prerequisites:

  1. A Linux host system with Ubuntu 18.04.
  2. Install Android Platform tools (ADB)
  3. Install SSH on host and Qualcomm Robotics RB5 for secure shell communication.
  4. Install python3 on host and Qualcomm Robotics RB5

Steps to fine-tune the Google T5-small model

  1. Install conda by using this link.
  2. After Installation, create the conda environment by using the given commands
$ conda create –name <env_name>

3. To check the conda environment list & activate

$ conda env list
$ conda activate <env_name>

4. Run the requirements for fine-tunning the model

$ pip install -r requirements.txt

Data Example

Collect data relevant to your use case, which can be found in the SLM/Training directory. This directory contains both the training and test datasets necessary for model development and evaluation

 

ID Question Answer
0 What is the main processor used in the Qualcomm Robotics RB5 development kit? The main processor used in the Qualcomm Robotics RB5 development kit is the Qualcomm® QRB5165 processor.
1 What are some key features of the Qualcomm Robotics RB5 development kit? Some key features of the Qualcomm Robotics RB5 development kit include high-speed wireless connectivity, high-accuracy artificial intelligence (AI) and machine-learning inferencing technology, and support for power-efficient, high-computing robots and drones for enterprise, industrial, and professional service applications.

Collect Data: Gather your dataset and save it in CSV format.

Organize Data: Place the collected data into the data folder.

File Naming: Ensure the CSV files are named as follows:

Training data: train.csv

Testing data: test.csv

Make sure the data folder contains these two files before proceeding with the next steps.

Training Information:

The model was trained for 50 epochs with a learning rate of 1e-3 to ensure efficient and effective learning. Here are the key details of the training configuration:

Epochs: 50 epochs, representing complete passes through the training dataset to achieve optimal performance.

Learning Rate: Set to 1e-3 to accelerate the training process while maintaining stability.

Batch Size: Dynamically determined using auto_find_batch_size for efficient GPU memory utilization.

Model: google/flan-t5-small, designed for tasks like text summarization and question answering.

LoRA Configuration:

r=16

lora_alpha=32

Target modules: ["q", "v"]

lora_dropout=0.05

Task type: SEQ_2_SEQ_LM

LoRA fine-tunes a subset of model parameters, reducing computational resources required.

Data Collator: DataCollatorForSeq2Seq used to handle padding, with label_pad_token_id set to -100 to ignore padding tokens in loss computation.

Logging: Training progress logged every 500 steps, reported to TensorBoard.

Int8 Training: Model prepared for int8 (8-bit integer) training to optimize memory usage and speed without significant accuracy loss.

By combining these techniques, the model efficiently learned and generalized from the training data, ensuring enhanced performance and effective fine-tuning with LoRA.

Fine-tune the Google T5 Model

Execute the fine-tuning script located in the SLM/Training directory.

$ python3 Training/t5_tuning.py 
Audio

Upon successful fine-tuning, it will generate the rb5_model, customized for your specific use case.

SLM Model Inference on Qualcomm Robotics RB5

To deploy the custom model and simple UI to the RB5, follow these steps:

Prepare the Files:
       Place the custom model and the simple UI in a folder.

Transfer the Files:

Using SSH:

$ ssh root@<ip_rb5>
$ scp -r < path_to_your_folder> root@<ip_rb5>:<destination_path_on_rb5> 

Using ADB:

adb push < path_to_your_folder> <destination_path_on_rb5>

Replace <ip_rb5> with the IP address of your Qualcomm Robotics RB5, <path_to_your_folder> with the local path to your folder, and <destination_path_on_rb5> with the desired destination path on the Qualcomm Robotics RB5.

Start the Flask Application: Run the inference script to launch the Flask application.

 sh4$ python3 app.py

This command will start the Flask server on rb5_ip:5000.

Use the Web Interface: Open a web browser and navigate to the Flask application's address (http://rb5_ip:5000). The user interface will be displayed.

Record and Process: Click the "Record and Process" button on the UI. You can now ask your question using voice commands.

Voice to Text Translation: The system will capture your voice input, translate it to text, and send it to the fine-tuned model for processing.

Display Generated Output: The model will generate a response based on the input question, and the output will be displayed on the screen in the user interface.

Audio

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries ("Qualcomm"). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.

Project Authors
Capgemini
Pinisetti Vijaya GaneshAssociate l – Engineer
Avdhesh ChouhanProfessional II
Ashish TiwariArchitect

Sign up for the Developer Newsletter.

Get software and hardware tool resources to help optimize your development delivered to your inbox weekly.

Qualcomm relentlessly innovates to deliver intelligent computing everywhere, helping the world tackle some of its most important challenges. Our leading-edge AI, high performance, low-power computing, and unrivaled connectivity deliver proven solutions that transform major industries. At Qualcomm, we are engineering human progress.

Stay connected

Get the latest Qualcomm and industry information delivered to your inbox.

Subscribe
Manage your subscription

© Qualcomm Technologies, Inc. and/or its affiliated companies.

Snapdragon and Qualcomm branded products are products of Qualcomm Technologies, Inc. and/or its subsidiaries. Qualcomm patented technologies are licensed by Qualcomm Incorporated.

Note: Certain services and materials may require you to accept additional terms and conditions before accessing or using those items.

References to "Qualcomm" may mean Qualcomm Incorporated, or subsidiaries or business units within the Qualcomm corporate structure, as applicable.

Qualcomm Incorporated includes our licensing business, QTL, and the vast majority of our patent portfolio. Qualcomm Technologies, Inc., a subsidiary of Qualcomm Incorporated, operates, along with its subsidiaries, substantially all of our engineering, research and development functions, and substantially all of our products and services businesses, including our QCT semiconductor business.

Materials that are as of a specific date, including but not limited to press releases, presentations, blog posts and webcasts, may have been superseded by subsequent events or disclosures.

Nothing in these materials is an offer to sell or license any of the services or materials referenced herein.