ricdomolm commited on
Commit
1ef19a9
·
verified ·
1 Parent(s): d8d0dd0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -1
README.md CHANGED
@@ -30,7 +30,7 @@ We report mean classification accuracy across the 260 legal classification tasks
30
 
31
  ## FAQ
32
 
33
- **What are the Lawma models useful for?** We recommend using the Lawma models only for the legal classification tasks that they models were fine-tuned on. The main take-away of our paper is that specializing models leads to large improvements in performance. Therefore, we strongly recommend practitioners to further fine-tune Lawma on the actual tasks that the models will be used for. Relatively few examples --i.e, dozens or hundreds-- may already lead to large gains in performance.
34
 
35
  **Should I use Lawma 8B or 70B?** Lawma 70B outperforms Lawma 8B on about 67% of the tasks, on average by a small amount, typically between 1 and 2 accuracy points. Therefore, practitioners may prefer to use Lawma 8B for its significantly cheaper inference and fine-tuning, with little cost in terms of model performance.
36
 
@@ -38,6 +38,50 @@ We report mean classification accuracy across the 260 legal classification tasks
38
  even the best models leave much room for improvement. From a substantive legal perspective, efficient
39
  solutions to such classification problems have rich and important applications in legal research.
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ## Citation
42
 
43
  This model was trained for the project
 
30
 
31
  ## FAQ
32
 
33
+ **What are the Lawma models useful for?** We recommend using the Lawma models only for the legal classification tasks that they models were fine-tuned on. The model has been fine-tuned on multiple-choice questions, not on general instructions. Therefore, the model only outputs multiple choice letters (e.g., A, B, C, etc) or numbers. The main take-away of our paper is that specializing models leads to large improvements in performance. Therefore, we strongly recommend practitioners to further fine-tune Lawma on the actual tasks that the models will be used for. Relatively few examples --i.e, dozens or hundreds-- may already lead to large gains in performance.
34
 
35
  **Should I use Lawma 8B or 70B?** Lawma 70B outperforms Lawma 8B on about 67% of the tasks, on average by a small amount, typically between 1 and 2 accuracy points. Therefore, practitioners may prefer to use Lawma 8B for its significantly cheaper inference and fine-tuning, with little cost in terms of model performance.
36
 
 
38
  even the best models leave much room for improvement. From a substantive legal perspective, efficient
39
  solutions to such classification problems have rich and important applications in legal research.
40
 
41
+ ## Example use
42
+
43
+ ```python
44
+ from transformers import AutoModelForCausalLM, AutoTokenizer
45
+
46
+ model_dir = "ricdomolm/lawma-8b"
47
+
48
+ tokenizer = AutoTokenizer.from_pretrained(model_dir)
49
+ model = AutoModelForCausalLM.from_pretrained(model_dir)
50
+
51
+ def generate_response(input_text):
52
+ inputs = tokenizer(input_text, return_tensors="pt")
53
+ outputs = model.generate(inputs.input_ids, max_length=2048, do_sample=False)
54
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
55
+
56
+ return response
57
+
58
+ input_text = """This case may seem at first blush too inconsequential to find its way into our bdoks, but the issue it presents is of no small constitutional significance.
59
+ Appellant Paul Robert Cohen was convicted in the Los Angeles Municipal Court of violating that part of California Penal Code § 415 which prohibits “maliciously and willfully disturb [ing] the peace or quiet of any neighborhood or person. ■.. by... offensive conduct... He was given 30 days’imprisonment. The facts upon which his conviction rests are detailed in the opinion of the Court of Appeal of California, Second Appellate District, as follows:
60
+ “On April 26, 1968, the defendant was observed in the Los Angeles County Courthouse in the corridor outside of division 20 of the municipal court wearing a jacket bearing the words ‘F the Draft’ which were plainly visible. There were women and children present in the corridor. The defendant was arrested. The defendant testified that he wore the jacket knowing that the words were on the jacket as a means of informing the public of the depth of his feelings against the Vietnam War and the draft.
61
+ “The defendant did not engage in, nor threaten to engage in, nor did anyone as the result of his conduct in fact commit or threaten to commit any act. of violence. The defendant did not make any loud or unusual noise, nor was there any evidence that he uttered any sound prior to his arrest.” 1 Cal. App. 3d 94, 97-98, 81 Cal. Rptr. 503, 505 (1969).
62
+ In affirming the conviction the Court of Appeal held that' “offensive conduct” means “behavior which has a tendency to provoke others to acts of violence or to in turn disturb the peace,” and that the State had,proved this element because, on the facts of this case, “[i]t was certainly reasonably foreseeable that.such conduct might cause others to rise up to commit a violent act against the person of the defendant or attempt to forceably remove his jacket.” 1 Cal. App. 3d, at 99-100, 81 Cal.
63
+
64
+ Question: What is the issue area of the decision?
65
+ A. Criminal Procedure
66
+ B. Civil Rights
67
+ C. First Amendment
68
+ D. Due Process
69
+ E. Privacy
70
+ F. Attorneys
71
+ G. Unions
72
+ H. Economic Activity
73
+ I. Judicial Power
74
+ J. Federalism
75
+ K. Interstate Relations
76
+ L. Federal Taxation
77
+ M. Miscellaneous
78
+ N. Private Action
79
+ Answer:"""
80
+
81
+ output = generate_response(input_text)
82
+ print(output)
83
+ ```
84
+
85
  ## Citation
86
 
87
  This model was trained for the project