Giter Club home page Giter Club logo

mistral7b-html-gen-figr's Introduction

Mistral7B-HTML-Gen-figr

Welcome to the repository, where I've fine-tuned the Mistral 7B model specifically for the generation of HTML code.

Objectives Addressed

  1. Model Section.
  2. Data Preparation.
  3. Tokenization.
  4. Fine-Tuning with LoRA
  5. Evaluation
  6. API dev

Objective

The primary goal of this assignment was to fine-tune the Mistral 7B model for generating HTML code from natural language prompts.

Dataset

I utilized the jawerty/html_dataset from Hugging Face Datasets, containing 43 examples of natural language prompts paired with corresponding HTML code.

Model Selection and Architecture

  • At the core of Mistral 7B lies a Transformer architecture, a fundamental component of modern language models. Nevertheless, it introduces several groundbreaking innovations that contribute to its exceptional performance. In comparison to Llama, it brings about some significant changes: enter image description here
  • The Mistral 7B model, a 7.3B parameter transformer with Grouped-query attention (GQA) and Sliding Window Attention (SWA), was selected for its optimal balance between performance and efficiency. GQA enhances inference speed, while SWA handles longer sequences effectively.

Data Preparation

I carefully prepared the data by splitting it into training and testing sets, adding special tokens, padding, and masking. Token distribution visualizations were employed, experimenting with LangChain Recursive Splitter and SWA features to handle large token lengths in HTML code.

Fine-Tuning with LoRA

The fine-tuning process involved the use of Low Rank Adaptation (LoRA), a parameter-efficient approach that outperformed full finetuning in certain cases. enter image description here

Leveraging the Hugging Face PEFT library, I set hyperparameters based on model documentation and employed the PyTorch Trainer class for efficient training. WandB was used for visualization and tracking during training.

API Development

To facilitate user interaction with the fine-tuned model, I implemented an API using Flask. Users can input natural language queries, and the model will generate corresponding HTML code. This enhances the practical application of the model by making it accessible and user-friendly.

Evaluation

The model's performance was evaluated using ROUGE scores (1, 2, L), perplexity, and visual inspection of generated HTML code. WandB facilitated result logging and comparison between different data preparation methods.

Challenges Faced

Challenges included GPU interruptions during training in Colab, handling large token lengths in HTML codes, and the complexity of tensor manipulation and training parameters.

  • Token Distribution Visualizations

Token distribution

Documentation

Check out the documentation at this link -> Access HereπŸ‘†

Conclusion

In conclusion, my journey from model selection to fine-tuning, evaluation, and API development has been both challenging and rewarding. Thank you for reading, and I hope you find this Readme.md was helpful and informative.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.

mistral7b-html-gen-figr's People

Contributors

zaheer-10 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.