Skip to main content

library for the ai competition, currently private

Project description

EMO_AI

Use state-of-the-art to detect the user's emotion on social apps, particularly needed in modern society

Installation

it's recommended to install pytorch via official guide first

package info: here

# stable version: have to install transformers, tokenizers, torch by hand ...
pip install EMO-AI==0.0.5

# latest version
pip install EMO-AI

Usage

Very high level one

from EMO_AI.all import *
# default model w/out pretrained weight
model = get_model(pretrained=False)
print(get_output("this love has taken it's toll on me", model)

High level one

from EMO_AI.model_api import *
PATH = "the_model.pt"
model = get_model(PATH)
text = "This love has taken its toll on me"
result = get_output(text, model)
print(result)

A bit in-detail one

from EMO_AI.model_api import *
from EMO_AI.data_process import *
t = "Elvis is the king of rock"
tokenizer = get_tokenizer()
PATH = "your_pretrained_model.pt"
# check how the model is saved in the first place
model = get_model(PATH, inference_only=True)
import torch
with torch.no_grad():
    model.eval() # evaluate mode
    # convert_text_to_tensor(t) would work, but kinda slower and wasteful
    rep = model(convert_text_to_tensor(t, tokenizer))
# print output tensor from forward pass
print(rep)
# get predicted emotion
print_emotion(rep)

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

EMO_AI-0.0.5.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

EMO_AI-0.0.5-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file EMO_AI-0.0.5.tar.gz.

File metadata

  • Download URL: EMO_AI-0.0.5.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for EMO_AI-0.0.5.tar.gz
Algorithm Hash digest
SHA256 eb45449695648c8fcda7a32a272261fc13cef39e130f5acb7500e023ccc3dc40
MD5 63c9e91073c6b5b67622d79a29218f25
BLAKE2b-256 1045ab08964549e9bb62cf58490906f64a54c6a7a5a98d131da2caa74d686e5c

See more details on using hashes here.

File details

Details for the file EMO_AI-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: EMO_AI-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for EMO_AI-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6bd8a0fd4c8b1c48f756c4eecaee3e809e767462ac4a3a6331cee67cb5894789
MD5 05447ee817e439d561096b960156353c
BLAKE2b-256 268213127e6265a7afb47518deb2a08474ace865b41843fe2c61d0ed1657ed44

See more details on using hashes here.

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