Create an AI assistant for lawyers
Please read the topic categorydescriptionto understand what this is all aboutDescriptionThe Contract Understanding Atticus Dataset (CUAD) is a new dataset for legal contract review. Legal contracts often contain a small number of important clauses that warrant review by lawyers. This is a time-intensive task that requires specialised knowledge, so the goal of this project is to see if Transformer models can be used to extract answers to a predefined set of legal questions.Model(s)Many of theQuestion Answeringmodelson the Hub could serve as a good baseline to get started. Given the specialised domain, you will probably want to try:Fine-tuning encoder-based models like BERT, RoBERTa, DeBERTa and friendsPerforming domain adaptation, by first fine-tuning the language model before tuning the question-answering headDatasetsCUADis available on the Hub.ChallengesThis is a highly specialised domain, so a vanilla Transformer may not obtain great results.Desired project outcomesCreate a Streamlit of Gradio app onSpaces that allows someone to select a legal contract, one or more questions, and provide the answer.Additional resourcesCUAD announcementCUAD paperCUAD codebaseDiscord channelTo chat and organise with other people interested in this project, head over to ourDiscordand:Follow the instructions on the#join-coursechannelJoin the#ai-law-assistantchannelJust make sure you comment here to indicate that you’ll be contributing to this project
2021-11-14T12:31:21Z
Hi@lewtun, my name is Pavle and I would be interested in working on this project.
2021-11-14T14:52:02Z
Hey@pmarkovic, I’ve just created a Discord channel (see topic description) in case you and others want to coordinate there
2021-11-17T07:27:51Z
can somebody look at my notebook and help me to resolve the issue.AI_assistant_law | KaggleI am using blurr library which depends on fastaifollowing is error trace of learn.summary()/tmp/ipykernel_36/2746549787.py in <module>
----> 1 learn.summary()

/opt/conda/lib/python3.7/site-packages/fastai/callback/hook.py in summary(self)
    205     "Print a summary of the model, optimizer and loss function."
    206     xb = self.dls.train.one_batch()[:getattr(self.dls.train, "n_inp", 1)]
--> 207     res = module_summary(self, *xb)
    208     res += f"Optimizer used: {self.opt_func}\nLoss function: {self.loss_func}\n\n"
    209     if self.opt is not None:

/opt/conda/lib/python3.7/site-packages/fastai/callback/hook.py in module_summary(learn, *xb)
    173     #  thus are not counted inside the summary
    174     #TODO: find a way to have them counted in param number somehow
--> 175     infos = layer_info(learn, *xb)
    176     n,bs = 76,find_bs(xb)
    177     inp_sz = _print_shapes(apply(lambda x:x.shape, xb), bs)

/opt/conda/lib/python3.7/site-packages/fastai/callback/hook.py in layer_info(learn, *xb)
    157         train_only_cbs = [cb for cb in learn.cbs if hasattr(cb, '_only_train_loop')]
    158         with learn.removed_cbs(train_only_cbs), learn.no_logging(), learn as l:
--> 159             r = l.get_preds(dl=[batch], inner=True, reorder=False)
    160         return h.stored
    161 

/opt/conda/lib/python3.7/site-packages/fastai/learner.py in get_preds(self, ds_idx, dl, with_input, with_decoded, with_loss, act, inner, reorder, cbs, **kwargs)
    256             pred_i = 1 if with_input else 0
    257             if res[pred_i] is not None:
--> 258                 res[pred_i] = act(res[pred_i])
    259                 if with_decoded: res.insert(pred_i+2, getattr(self.loss_func, 'decodes', noop)(res[pred_i]))
    260             if reorder and hasattr(dl, 'get_idxs'): res = nested_reorder(res, tensor(idxs).argsort())

/opt/conda/lib/python3.7/site-packages/blurr/modeling/question_answering.py in activation(self, outs)
     77 
     78     def activation(self, outs):
---> 79         acts = [ self.loss_funcs[i].activation(o) for i, o in enumerate(outs) ]
     80         return acts
     81 

/opt/conda/lib/python3.7/site-packages/blurr/modeling/question_answering.py in <listcomp>(.0)
     77 
     78     def activation(self, outs):
---> 79         acts = [ self.loss_funcs[i].activation(o) for i, o in enumerate(outs) ]
     80         return acts
     81 

/opt/conda/lib/python3.7/site-packages/fastai/losses.py in activation(self, x)
     46     def __init__(self, *args, axis=-1, **kwargs): super().__init__(nn.CrossEntropyLoss, *args, axis=axis, **kwargs)
     47     def decodes(self, x):    return x.argmax(dim=self.axis)
---> 48     def activation(self, x): return F.softmax(x, dim=self.axis)
     49 
     50 # Cell

/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py in softmax(input, dim, _stacklevel, dtype)
   1677         dim = _get_softmax_dim("softmax", input.dim(), _stacklevel)
   1678     if dtype is None:
-> 1679         ret = input.softmax(dim)
   1680     else:
   1681         ret = input.softmax(dim, dtype=dtype)

AttributeError: 'str' object has no attribute 'softmax' ```
2021-11-17T11:27:34Z
Hey@durgaamma2005I suggest opening an issue on theblurrGitHub repository since I’m sure they can help you with your query (I personally have no experience withblurr)
2021-11-17T22:22:29Z
@lewtuncan you hint at any data preprocessing for CUADalso i am using Colab with 25GB of ram, the session is crashing during the preprocessing step, is there any work around for this ?
2021-11-17T22:39:55Z
Are you having trouble with the tokenizer or something else? If it’s the GPU RAM that’s the problem, one idea would be to reduce the batch size during training
2021-11-17T22:49:46Z
i am having issue with preprocessing step before tokenizing the dataset because some of the questions have several possible answers, i am getting list index out of rangeScreenshot 2021-11-17 at 20.22.311616×994 146 KB
2021-11-17T23:05:48Z
Hey@muhtashamone special aspect of CUAD is that it has long documents and produces a lot of passages for which there are no answers to be found. I suggest using the CUAD training script in their codebase (see topic description) as a starting point
2022-07-22T17:25:49Z
Hi@lewtunI’m interested in this project,  Is there any resources about data processing how to build a training data with my own contracts ?? I checked in the CUAD github project but I can’t find it, I looked into discord for the#ai-law-assistantchannel but can’t find it.could you help me please?thanks in advance
2022-07-23T19:00:53Z
casetext.comalready does this very well.
2022-07-29T11:58:58Z
I hope this project is still on going, as I am super interested.
2023-02-21T04:12:59Z
Interested in similar project for family firm. Following and willin* to help.