ONNX Model Zoo

ai-agi/bert-large-portuguese-cased-finance

By ai-agi · ↓ 2 · ♥ 0 · Updated 2024-01-08

What's in this repo

This page lists the files in ai-agi/bert-large-portuguese-cased-finance, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 17 files, including 4 .json, 2 .txt, 1 .md, 1 .data-00000-of-00001, 1 .index, 1 .meta
  • Last updated 2024-01-08

ONNX files

File Size Download
model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

BERTimbau Large Finance ("bert-large-portuguese-cased-finance")

image/png

Introduction

BERTimbau Finance Large is a model fine-tuned using two major Brazilian banking datasets, placing it within the finance domain.

It was developed by fine-tuning the BERTimbau Large language model.

BERTimbau Finance Large is available in multiple formats: Pytorch, Safetensors, Tensorflow 2, Tensorflow 1 checkpoints, ONNX.

BERTimbau Large is a pretrained BERT model for Brazilian Portuguese that achieves state-of-the-art performances on three downstream NLP tasks: Named Entity Recognition, Sentence Textual Similarity and Recognizing Textual Entailment. It is available in two sizes: Base and Large.

For further information, please direct to BERTimbau repository.

Available models

Model Arch. #Layers #Params
ai-agi/bert-large-portuguese-cased-finance BERT-Large 24 335M

Usage

from transformers import AutoTokenizer  # Or BertTokenizer
from transformers import AutoModelForPreTraining  # Or BertForPreTraining for loading pretraining heads
from transformers import AutoModel  # or BertModel, for BERT without pretraining heads

model = AutoModelForPreTraining.from_pretrained('ai-agi/bert-large-portuguese-cased-finance')
tokenizer = AutoTokenizer.from_pretrained('ai-agi/bert-large-portuguese-cased-finance', do_lower_case=False)

Masked language modeling prediction example

from transformers import pipeline

pipe = pipeline('fill-mask', model=model, tokenizer=tokenizer)

pipe('Tinha uma [MASK] no meio do caminho.')
# [{'score': 0.5054386258125305,
#   'sequence': '[CLS] Tinha uma pedra no meio do caminho. [SEP]',
#   'token': 5028,
#   'token_str': 'pedra'},
#  {'score': 0.05616172030568123,
#   'sequence': '[CLS] Tinha uma curva no meio do caminho. [SEP]',
#   'token': 9562,
#   'token_str': 'curva'},
#  {'score': 0.02348282001912594,
#   'sequence': '[CLS] Tinha uma parada no meio do caminho. [SEP]',
#   'token': 6655,
#   'token_str': 'parada'},
#  {'score': 0.01795753836631775,
#   'sequence': '[CLS] Tinha uma mulher no meio do caminho. [SEP]',
#   'token': 2606,
#   'token_str': 'mulher'},
#  {'score': 0.015246033668518066,
#   'sequence': '[CLS] Tinha uma luz no meio do caminho. [SEP]',
#   'token': 3377,
#   'token_str': 'luz'}]

For BERT embeddings


import torch

model = AutoModel.from_pretrained('ai-agi/bert-large-portuguese-cased-finance')
input_ids = tokenizer.encode('Tinha uma pedra no meio do caminho.', return_tensors='pt')

with torch.no_grad():
    outs = model(input_ids)
    encoded = outs[0][0, 1:-1]  # Ignore [CLS] and [SEP] special tokens

# encoded.shape: (8, 1024)
# tensor([[ 1.1872,  0.5606, -0.2264,  ...,  0.0117, -0.1618, -0.2286],
#         [ 1.3562,  0.1026,  0.1732,  ..., -0.3855, -0.0832, -0.1052],
#         [ 0.2988,  0.2528,  0.4431,  ...,  0.2684, -0.5584,  0.6524],
#         ...,
#         [ 0.3405, -0.0140, -0.0748,  ...,  0.6649, -0.8983,  0.5802],
#         [ 0.1011,  0.8782,  0.1545,  ..., -0.1768, -0.8880, -0.1095],
#         [ 0.7912,  0.9637, -0.3859,  ...,  0.2050, -0.1350,  0.0432]])

Model info

fill-mask transformers
transformers pytorch tf onnx safetensors bert fill-mask tensorflow 2 tensorflow 1 pt dataset:brBanking license:apache-2.0
↓ 2 ♥ 0

Created: 2024-01-08

Updated: 2024-01-08

View on Hugging Face

Files (17)

.gitattributes
README.md
checkpoint
config.json
eval_results.txt
model.ckpt.data-00000-of-00001
model.ckpt.index
model.ckpt.meta
model.onnx ONNX
model.safetensors
model_args.json
pytorch_model.bin
special_tokens_map.json
tf_model.h5
tokenizer_config.json
training_progress_scores.csv
vocab.txt

Related models