Skip to content

alturkim/nlp-notebooks

Repository files navigation

nlp-notebooks

A collection of Jupyter notebook on various NLP topics.

Content

Sentiment Analysis with Hugging Face Trainer API.

The HF Trainer API is a simple way to train a model for a specifi task. There are many supported NLP tasks in the HF library. See the doc for details.

Sentiment Analysis with Pytorch.

This is a more detailed implementation of the code in the previous notebook (Sentiment Analysis with Hugging Face Trainer API.) Here we use pytorch training loop which gives you more control into your training and evaluation.

Few-shot Arabic sentiment Analysis with SetFit.

SefFit is an algorithm for few-shot learning based on the sentence-transformer library. On a high level, the algorithm fine-tune a sentence-transformer model using Contrastive Learning such that embeddings of examples of different classes are pushed apart, and embeddings for same-class examples are pulled closer. A more detailed description can be found on my Linkedin post here

Sentiment_Analysis_with_Parameter_Efficient_Finetuning.

Parameter Efficient Finetuning aims to reduce the amount of necessary computation power (GPU time and disk space) needed to finetune and deploy a system based on Large Language Model (or any pretrained large model), there are several methods proposed in the literature, here we are using the method from LoRA: Low-Rank Adaptation of Large Language Models as implemented in the PEFT library by Hugging Face. For more about the PEFT library see my Linkedin post here