LEGAL-BERT: The Muppets straight out of Law School
Paper • 2010.02559 • Published
How to use ggomarr/legal-bert-base-uncased-safetensors with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("feature-extraction", model="ggomarr/legal-bert-base-uncased-safetensors") # Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("ggomarr/legal-bert-base-uncased-safetensors")
model = AutoModel.from_pretrained("ggomarr/legal-bert-base-uncased-safetensors", device_map="auto")This is a safetensors serialization of the model nlpaueb/legal-bert-base-uncased. It is functionally identical to the original, but uses the safetensors format for:
transformers with safe_serialization=True.from transformers import AutoTokenizer, AutoModel
repo\_id = "your-username/legal-bert-base-uncased-safetensors"
tokenizer = AutoTokenizer.from\_pretrained(repo\_id)
model = AutoModel.from\_pretrained(repo\_id)
inputs = tokenizer("The court finds the defendant guilty.", return\_tensors="pt")
outputs = model(\*\*inputs)
The outputs are identical to the PyTorch .bin version of the model.
@article{chalkidis2020legal,
title={LEGAL-BERT: The Muppets straight out of Law School},
author={Chalkidis, Ilias and Fergadiotis, Manos and Malakasiotis, Prodromos and Aletras, Nikolaos and Androutsopoulos, Ion},
journal={arXiv preprint arXiv:2010.02559},
year={2020}
}
This model is distributed under the Creative Commons Attribution-ShareAlike 4.0 International License, in accordance with the license of the original legal-bert-base-uncased model.