Git Product home page Git Product logo

torchformers's Introduction

๐ŸŒŸ Torchformers: A Lightweight and Highly Customizable Transformers Library ๐ŸŒŸ

๐ŸŒ Overview:

Torchformers is a minimalist, lightweight Python package designed for ease of use, high customization, and efficiency, focusing on providing core Transformer models and their building blocks essential for Natural Language Processing tasks. It is built on top of PyTorch, ensuring optimized implementations of the models.

๐Ÿ”ฅ Features:

  • Lightweight Design: Torchformers is extremely lightweight, making it an ideal choice for developers who prefer a clean and uncomplicated interface for Transformer models.
  • Core Models and Building Blocks: The package includes implementations of three fundamental Transformer models: the original Transformer, BERT, and GPT, along with their essential building blocks, allowing users to construct their own models with ease.
  • High Customization: Torchformers offers extensive customization options, enabling users to modify and adapt the models and their components to suit a variety of NLP tasks and requirements.
  • Single Dependency: Torchformers requires only PyTorch as a dependency, ensuring a smooth and straightforward installation and setup process.

๐Ÿ›  Core Models and Building Blocks:

  • Transformer: The base model and its building blocks provide the foundational architecture for transforming input sequences into output sequences.
  • BERT: A versatile model and its components are designed for a range of NLP tasks, offering bidirectional context-based representations.
  • GPT: A generative model and its essential elements are capable of producing coherent and contextually relevant text based on the provided input.

๐Ÿ— Build Your Own Model:

With the provided building blocks and custom layers, users can easily assemble their custom models tailored to their specific needs:

from torch import nn
from torchformers import SelfAttentionBlock, TransformerDecoderBlock

class MyTransformer(nn.Module):
    def __init__(self):
        super().__init__()
        
        # Initialize custom layers and building blocks
        self.layer1 = TransformerDecoderBlock(...)  # Specify the required parameters
        # Initialize more layers and blocks as needed
        
    def forward(self, x):
        # Define the forward pass using the initialized blocks
        x = self.layer1(x)
        # Continue the forward pass with other layers and blocks as needed
        return x

๐Ÿ’ป Installation

To install this package from repository simply run

pip install git+https://github.com/max-fofanov/torchformers.git

๐Ÿค Cooperation

If you have any questions regarding this repository or have any research/work related offers you can reach me via email or telegram.

torchformers's People

Contributors

max-fofanov avatar

Stargazers

Adam Suliman avatar Ruslan Deymos avatar Nikita Pisarev avatar Alexander Fofanov avatar Ilya_Pronewsky avatar Dmitrii Uvarov avatar  avatar Vasiliy Gorelov 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.