Skip to main content

[MASK]it -Efficient pre-trained encoder adaption leveraging the [MASK]

Project description

[MASK]-It - Lightweight framework for efficient encoder model fine-tuning

Install

requires python 3.10 or above

pip install maskit-learn

Usage

Define task

# task and model
classes = ['happy', 'sad']
verbalizer_map = {'happy':['happy', 'fun'],
                  'sad':['sad', 'cry']}
model_name = 'google-bert/bert-base-uncased'

Select pre-trained model

from maskit.model import maskitModel
model = maskitModel(model_name=model_name,
                    verbalizer_map=verbalizer_map)

Load dataset

from torch.utils.data import DataLoader
from maskit.dataset import maskitDataset
text = ['I am so happy today that I cannot stay still','I am very very sad unfortunately']
labels = [1,0]
template = '{text}. This sentence is: [MASK]'
dataset = maskitDataset(text, labels, model_name, template)
dataloader = DataLoader(dataset=dataset, batch_size=2)

Inference

batch = next(iter(dataloader))
output = model(**batch)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maskit_learn-0.1.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maskit_learn-0.1.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file maskit_learn-0.1.2.tar.gz.

File metadata

  • Download URL: maskit_learn-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for maskit_learn-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f829c6c10fc5204a9eb4866bc50d8e328c78ab0cc3c202ef92f393639f98ebd9
MD5 93a61fc574cd04baa7414b74c220078f
BLAKE2b-256 5c2d7f18ea3d4b4b372b6d4867ebcccbd0ce09e4fae3684681bd84c63ab70060

See more details on using hashes here.

Provenance

The following attestation bundles were made for maskit_learn-0.1.2.tar.gz:

Publisher: publish.yml on eugeniaalleva/maskit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file maskit_learn-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: maskit_learn-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for maskit_learn-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c9d3172ff385f37a7fa648ee2bd3fa65eb017c41273ffc29a02c7aa31528f799
MD5 8c5df3765a12a2aea4c0ea0f943c9292
BLAKE2b-256 9081e9f33415fd6764d2adbc46f6da43ece4c38d5408c4f28e6615d3f65d44df

See more details on using hashes here.

Provenance

The following attestation bundles were made for maskit_learn-0.1.2-py3-none-any.whl:

Publisher: publish.yml on eugeniaalleva/maskit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page