Skip to main content

Mbedder is a language framework for adding contextual embeddings of pretrained language models to deep learning models.Mbedder is powered by PyTorch and HuggingFace and requires as less as 1 line of code to add embeddings and works similar to how the Embedding Layer works in PyTorch.

List of supported architectures

  • Bert
  • XLNet
  • Albert
  • TransfoXL
  • DistilBert
  • Roberta
  • XLM
  • XLMRoberta
  • GPT
  • GPT2
  • Flaubert

The pretrained models for the mentioned architecures can be found here.

Features

  • Addition of embeddings with 1 line of code
  • Embeddings can output Sentence as well as Token level embeddings
  • Task specific combination strategies can be applied to hidden states and token embeddings
  • Custom pre-trained hugging face transformer models can be used with Mbedder.

Requirements and Installation

  • PyTorch version >= 1.6.0
  • Python version >= 3.6
  • Transformer >= 3.0.2

Mbedder can be using Pip as follows

pip install Mbedder

Getting Started

A basic example of using a Mbedder Bert embedding is shown below:

import torch
from Mbedder import BertEmbedding

class BertClassifier(torch.nn.Module):
    def __init__(self, num_classes):
        super(BertClassifier, self).__init__()
        self.embedding = BertEmbedding.from_pretrained('bert-base-uncased')
        self.fc = torch.nn.Linear(self.embedding.embedding_size, num_classes)
    
    def forward(self, input_ids, attention_mask):
        x = self.embedding(input_ids, attention_mask, output_token_embeddings=False)
        logits = self.fc(x[0])
        return logits

More advanced examples can be found in the examples folder.

License

Mbedder is MIT-licensed.

Metadata

Release files for Mbedder 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Mbedder 0.0.4
File Size Uploaded Provenance Actions
Mbedder-0.0.4.tar.gz 5.9 kB Without provenance Details for Mbedder-0.0.4.tar.gz

Release files / Mbedder-0.0.4.tar.gz

Download URL Mbedder-0.0.4.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
aee1dc6279840ed08723c62ef842a573b2cf3868e11f44105005af29dc03721f
BLAKE2b-256 checksum
How to use checksums
b12513c88b8d9187a87619be9511468b04f4a6046fc9df3d8447205c59a031d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

Security for Mbedder 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page