Git Product home page Git Product logo

llm_tuning's Introduction

Finetuning Superlightweight Gemma-2B and Comparing Baseline Vs. Finetuned For Humor Detection

This project aims to finetune a lightweight Gemma-2B model with a custom dataset for humor detection. The project involves several steps:

1. Setting Up The Data

The first step is to import the necessary libraries and load the dataset. The dataset is split into training and testing sets. The training set is converted into a Dataset object from the datasets library.

2. Loading the Tokenizer and the Model for 2B

The tokenizer and the model for 2B are loaded using the AutoTokenizer and AutoModelForCausalLM classes from the transformers library.

3. Testing the Baseline Model on the Test Set

The baseline model is tested on the test set. The model is prompted to classify humor with the provided text. The function classify_humor_2b takes a text as input and returns whether the text contains humor or not.

4. Finetuning the Model

The model is finetuned using the SFTTrainer class from the trl library. The finetuned model is saved for later use.

5. Testing the Finetuned Model

The finetuned model is loaded and tested on the test set. The function classify_humor_tuned2b is similar to classify_humor_2b, but uses the finetuned model instead of the baseline model.

The results of the finetuned model are compared with the baseline model to evaluate the performance improvement. The classification report and confusion matrix are generated and saved for further analysis.

llm_tuning's People

Contributors

aryan-poonacha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.