律知

davidpig
4 liked
entry-slick
About 律知

Law Zhi (Lychee)

#### ⚖️ Proficient in the big language model of Chinese law ⚖️

#### Legal Consulting \| Defense Word Generation \| Judicial Examination Counseling

Introduction • Language ModelUsageDisplayDisclaimerLicense .

In order to allow legal services to reach everyone and allow more people to get legal help, we launched the [Law Zhi] project, which is committed to creating a series of big Model.

Our AI legal model is a virtual legal advisor with rich legal knowledge and skills, able to answer legal questions and provide legal advice.

This project will open source a series of large models in the Chinese judicial field , please pay attention, welcome to contact and cooperate🤝.

## Language Model 🤖

  • Law-GLM-10B : Based on the GLM-10B model, instruction fine-tuning is performed on 30GB Chinese legal data.
  • coming soon Introducing a more powerful legal language model ` from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

hf_model = "law-llm/law-glm-10b" max_question_length = 64 max_generation_length = 490

tokenizer = AutoTokenizer.from_pretrained( hf_model, cache_dir=model_cache_dir, use_fast=True, trust_remote_code=True )

model = AutoModelForSeq2SeqLM.from_pretrained( hf_model, cache_dir=model_cache_dir, trust_remote_code=True )

model = model.to('cuda') model.eval()

model_inputs = "提问: 犯了盗窃罪怎么判刑? 回答: [gMASK]"

model_inputs = tokenizer(model_inputs, max_length=max_question_length, padding=True, truncation=True, return_tensors="pt")

model_inputs = tokenizer.build_inputs_for_generation(model_inputs, targets=None, max_gen_length=max_generation_length, padding=True)

inputs = model_inputs.to('cuda')

outputs = model.generate(**inputs, max_length=max_generation_length, eos_token_id=tokenizer.eop_token_id) prediction = tokenizer.decode(outputs[0].tolist()) stay tuned! from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

hf_model = "law-llm/law-glm-10b" max_question_length = 64 max_generation_length = 490

tokenizer = AutoTokenizer.from_pretrained( hf_model, cache_dir=model_cache_dir, use_fast=True, trust_remote_code=True )

model = AutoModelForSeq2SeqLM.from_pretrained( hf_model, cache_dir=model_cache_dir, trust_remote_code=True )

model = model.to('cuda') model.eval()

model_inputs = "提问: 犯了盗窃罪怎么判刑? 回答: [gMASK]"

model_inputs = tokenizer(model_inputs, max_length=max_question_length, padding=True, truncation=True, return_tensors="pt")

model_inputs = tokenizer.build_inputs_for_generation(model_inputs, targets=None, max_gen_length=max_generation_length, padding=True)

inputs = model_inputs.to('cuda')

outputs = model.generate(**inputs, max_length=max_generation_length, eos_token_id=tokenizer.eop_token_id) prediction = tokenizer.decode(outputs[0].tolist()) `

## Demonstration ✨

### 1. Example of legal advice Services, in most cases can generate instructive recommendations based on real laws and regulations.

\| Question\| Answer (Law-GLM-10B, 2023.07.13, model output) \| \| ————————— \| ———————— ————————————— \| \| What is the punishment for the crime of theft? \| The crime of theft refers to stealing a large amount of property owned by others for the purpose of illegal possession, or multiple thefts the behavior of. The object of the crime of theft is limited to the property of the state, collective or individual, rather than defrauding other illegal interests. According to Article 264 of the "Criminal Law", whoever steals public or private property in a relatively large amount, or commits repeated theft, burglary, theft with a murder weapon, or pickpocketing shall be sentenced to fixed-term imprisonment of not more than three years, criminal detention, or public surveillance, and If the amount is huge or there are other serious circumstances, the sentence is to be between three and ten years of fixed-term imprisonment and a fine; if the amount is particularly huge or there are other particularly serious circumstances, the sentence is to be not less than ten years of fixed-term imprisonment or life imprisonment. fine or confiscation of property. \| \| Do juvenile crimes bear criminal responsibility? \| Juvenile crimes bear criminal responsibility. Article 17 of my country's "Criminal Law" stipulates that a person who has reached the age of 16 commits a crime and shall bear criminal responsibility. A person who has reached the age of 14 but has not yet reached the age of 16 commits the crime of intentional homicide, intentional injury causing serious injury or death, rape, robbery, drug trafficking, arson, explosion, or throwing dangerous substances shall bear criminal responsibility. Where a person who has reached the age of 12 but not the age of 14 commits the crime of intentional homicide or intentional injury, causing death or causing serious injury to a person by particularly cruel means and causing serious disability, and the circumstances are egregious, and the Supreme People's Procuratorate approves the prosecution, he shall bear criminal responsibility . Persons under the age of 18 who are investigated for criminal responsibility in accordance with the provisions of the preceding three paragraphs shall be given a lighter or mitigated punishment. If criminal punishment is not given because they are under the age of 16, their parents or other guardians shall be ordered to discipline them; when necessary, special correction education shall be carried out according to law. \|

### 2. Failure Cases 😖

Our model is far from perfect. The following are some failure cases, the answers given by the model in these cases are not Exactly. We are analyzing the limitations of the model and will continue to roll out more robust and accurate versions.

\| Ask \| Answer (Law-GLM-10B, 2023.07.13, model output) \| Analysis \| \| ————————————————— \| ——————————————— \| \| How to deal with employees who commit illegal fund-raising crimes? How many years are employees sentenced for illegal fund-raising crimes? 2. If the employee constitutes the crime of illegal fund-raising, he shall generally be sentenced to fixed-term imprisonment of not less than three years but not more than seven years and shall be fined; 3. The employee shall be sentenced to a crime of illegal fund-raising. Those who commit crimes are generally sentenced to fixed-term imprisonment of not less than seven years and concurrently to a fine or confiscation of property. Legal basis: Article 192 of the "Criminal Law" who illegally raises funds by means of fraud for the purpose of illegal possession, and if the amount is relatively large, shall be sentenced to fixed-term imprisonment of not more than three years or criminal detention, and shall also be sentenced to a fine; For other serious circumstances, he shall be sentenced to fixed-term imprisonment of not less than three years but not more than seven years , and shall also be fined. Units that commit crimes in the preceding paragraph shall be fined, and the directly responsible managers and other directly responsible personnel shall be punished in accordance with the provisions of the preceding paragraph. \| The citation of the law is correct, and the sentence is wrong (should be "a fixed-term imprisonment of not less than five years but not more than ten years") \| \| After the prisoner is arrested, will the family be notified? How often will I be notified? \| After the arrest, the family will be notified. According to Article 69 of the Criminal Procedure Law , when a public security organ arrests a person, it must produce an arrest warrant. After arrest, the arrested person shall be sent to the detention center for custody immediately, no later than 24 hours. Except for circumstances where it is impossible to notify or suspected of endangering national security crimes or terrorist activities, the notification may hinder the investigation, the family members of the arrested person shall be notified within 24 hours after the arrest. After the circumstances that hinder the investigation disappear, the family members of the arrested person shall be notified immediately. \| The answer is basically correct, but the citation of the law is wrong\|

Visit Official Website

https://github.com/davidpig/lychee_law

Community Posts
no data
Nothing to display