Views
No views yet
1>>> from transformers import pipeline
2>>> pipe = pipeline(task='fill-mask', model='pile-of-law/legalbert-large-1.7M-2')
3>>> pipe("An [MASK] is a request made after a trial by a party that has lost on one or more issues that a higher court review the decision to determine if it was correct.")
4
5[{'sequence': 'an exception is a request made after a trial by a party that has lost on one or more issues that a higher court review the decision to determine if it was correct.',
6 'score': 0.5218929052352905,
7 'token': 4028,
8 'token_str': 'exception'},
9 {'sequence': 'an appeal is a request made after a trial by a party that has lost on one or more issues that a higher court review the decision to determine if it was correct.',
10 'score': 0.11434809118509293,
11 'token': 1151,
12 'token_str': 'appeal'},
13 {'sequence': 'an exclusion is a request made after a trial by a party that has lost on one or more issues that a higher court review the decision to determine if it was correct.',
14 'score': 0.06454459577798843,
15 'token': 5345,
16 'token_str': 'exclusion'},
17 {'sequence': 'an example is a request made after a trial by a party that has lost on one or more issues that a higher court review the decision to determine if it was correct.',
18 'score': 0.043593790382146835,
19 'token': 3677,
20 'token_str': 'example'},
21 {'sequence': 'an objection is a request made after a trial by a party that has lost on one or more issues that a higher court review the decision to determine if it was correct.',
22 'score': 0.03758585825562477,
23 'token': 3542,
24 'token_str': 'objection'}]1from transformers import BertTokenizer, BertModel
2tokenizer = BertTokenizer.from_pretrained('pile-of-law/legalbert-large-1.7M-2')
3model = BertModel.from_pretrained('pile-of-law/legalbert-large-1.7M-2')
4text = "Replace me by any text you'd like."
5encoded_input = tokenizer(text, return_tensors='pt')
6output = model(**encoded_input)1from transformers import BertTokenizer, TFBertModel
2tokenizer = BertTokenizer.from_pretrained('pile-of-law/legalbert-large-1.7M-2')
3model = TFBertModel.from_pretrained('pile-of-law/legalbert-large-1.7M-2')
4text = "Replace me by any text you'd like."
5encoded_input = tokenizer(text, return_tensors='tf')
6output = model(encoded_input)1>>> from transformers import pipeline
2>>> pipe = pipeline(task='fill-mask', model='pile-of-law/legalbert-large-1.7M-2')
3>>> pipe("The transcript of evidence reveals that at approximately 7:30 a. m. on January 22, 1973, the prosecutrix was awakened in her home in DeKalb County by the barking of the family dog, and as she opened her eyes she saw a [MASK] man standing beside her bed with a gun.", targets=["black", "white"])
4
5[{'sequence': 'the transcript of evidence reveals that at approximately 7 : 30 a. m. on january 22, 1973, the prosecutrix was awakened in her home in dekalb county by the barking of the family dog, and as she opened her eyes she saw a black man standing beside her bed with a gun.',
6 'score': 0.02685137465596199,
7 'token': 4311,
8 'token_str': 'black'},
9 {'sequence': 'the transcript of evidence reveals that at approximately 7 : 30 a. m. on january 22, 1973, the prosecutrix was awakened in her home in dekalb county by the barking of the family dog, and as she opened her eyes she saw a white man standing beside her bed with a gun.',
10 'score': 0.013632853515446186,
11 'token': 4249,
12 'token_str': 'white'}]1@misc{hendersonkrass2022pileoflaw,
2 url = {https://arxiv.org/abs/2207.00220},
3 author = {Henderson, Peter and Krass, Mark S. and Zheng, Lucia and Guha, Neel and Manning, Christopher D. and Jurafsky, Dan and Ho, Daniel E.},
4 title = {Pile of Law: Learning Responsible Data Filtering from the Law and a 256GB Open-Source Legal Dataset},
5 publisher = {arXiv},
6 year = {2022}
7}