Posts

Showing posts from January, 2023

Taking HuggingFace DistilBERT for a ride

Image
Image from https://www.pexels.com/@kindelmedia/ I have never dealt with BERT (Bidirectional Encoder Representations from Transformers is a transformer-based machine learning technique for natural language processing). And, I am trying it out. This simple experiment is made easy for Hugging Face ecosystem is making it easy for me to get started. There are already pre-trained models that I can use. Therefore I do not need to do ML training myself. Here is the code from transformers import DistilBertTokenizer, DistilBertForQuestionAnswering import torch tokenizer = DistilBertTokenizer.from_pretrained( "distilbert-base-uncased", return_token_type_ids=True ) model = DistilBertForQuestionAnswering.from_pretrained( "distilbert-base-uncased-distilled-squad", return_dict=False ) print('Enter your statement:') context = input() print() print('Enter your question:') question = input() while question: encoding = tokenizer.encode_plus(question, c

Azure Data Factory - add message to Blob Storage Queue

Image
Image from https://www.pexels.com/@khizar-hayat-431742/ Recently, I have had the opportunity to work on Azure Data Factory again. This time is about adding a message to Azure Blob Storage Queue via HTTP API . Create a Queue I created a queue, demo . Take note of its URL. demo queue Grant Access Add the Azure Data Factory's  System Assigned Managed Identity to Blob Storage's  Storage Queue Data Message Sender role. A new task in Azure Data Factory And here are its configuration. The HTTP headers are x-ms-version: 2020-04-08 x-ms-date: @{formatDateTime(utcNow(), 'r')} We have the message base64 encoded because the message is to be consumed in Azure Function App's Blob Storage Queue Trigger (read this for more information). Once this Azure Data Factory pipeline is executed, the message will be added to the queue and the function app will be executed too. Learnings There are a few learnings that I take away from this. The message needs to be base64 encoded, otherw