File size: 5,282 Bytes
6fe45dc
b235bfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6fe45dc
 
b235bfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
language:
  - en
inference: true
widget:
  - text: "What are the duties of the President of India as per the Constitution?"
    example_title: "Duties of President"
  - text: "Can you analyze the legal implications of the Ayodhya Verdict by the Supreme Court of India?"
    example_title: "Implications of Ayodhya Verdict"
  - text: "Can you summarize the main provisions of the Hindu Succession Act, 1956?"
    example_title: "Diving Top 10"
  - text: "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\nDevelop a legal strategy for a client based on the facts of the provided case.\n\n### Input:\nThe client in question is a government company that terminated the services of a permanent employee without providing any justification. The termination was carried out by invoking a rule similar to Rule 9(i) in the Central Inland Water Transport Corporation Ltd. vs Brojo Nath Ganguly & Anr. case. The employee who was terminated has taken legal action by challenging both the termination order and the validity of the rule in the High Court under Article 226.\n\n### Response:\n"
    example_title: "Create Legal Strategy 1"
  - text: "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction: \nDevelop a legal strategy for a hypothetical client based on the facts of the provided case.\n\n### Input:\nThe individual seeking assistance is a research scientist employed at a government-funded research institute, comparable to CSIR. They have been unjustly dismissed from their position and seek to contest the termination through legal means. The individual contends that the institute, being government-funded, qualifies as a 'State' as per Article 12 of the Constitution. Consequently, they believe they should have the right to file a writ petition against the institute.\n\n### Response:\n"
    example_title: "Create Legal Strategy 2"
  - text: "What is DV act ?"
    example_title: "Understand Act"
license: cc-by-4.0
---
# LokPalAI: Bridging the Gap to Legal Empowerment

LokPalAI is an advanced language model finetuned for Indian scenarios, specifically designed to bridge the gap between individuals and legal empowerment. With LokPalAI, users can interact with a powerful query box to seek information and guidance related to Indian law.


## Features:
1. Interact with LokPalAI’s Query Box: LokPalAI provides a user-friendly query box interface where users can input their legal queries and receive accurate and relevant responses. Whether you need information about a specific law, legal procedure, or any other legal matter, LokPalAI is here to assist you.
2. Enhanced with Rail Guards: To ensure the accuracy and reliability of the information provided, LokPalAI incorporates rail guards. These safeguards help prevent the generation of misleading or incorrect legal advice. We understand the importance of reliable legal information, and our rail guards are designed to maintain the highest standards of accuracy.
3. Real-Time Responses using RAG: LokPalAI leverages the Retrieve and Generate (RAG) framework to provide real-time responses to your legal queries. RAG combines the power of retrieval-based models with generation-based models, ensuring that the information provided is both contextually relevant and up to date.
4. Thorough Testing and Maintenance: We understand the criticality of maintaining a reliable and accurate legal information system. LokPalAI undergoes extensive testing to ensure its performance and reliability. We continuously monitor and update the model to account for changes in Indian law, ensuring that the information provided is always accurate and up to date.

# ✨ LokpalGPT-Instruct-Falcon-7b

## Dataset
The dataset is being curated and created using judgements available in IndianKanoon.com. You can refer the whole process here. Soon, we will be releasing our dataset and the training process.

## How to Use for Inference ?

💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**

For fast inference with Falcon, check-out [Text Generation Inference](https://github.com/huggingface/text-generation-inference)! Read more in this [blogpost]((https://huggingface.co/blog/falcon). 

You will need **at least 16GB of memory** to swiftly run inference with LokpalGPT-Instruct-Falcon-7b.


```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch

model = "lokpalai/lokpalgpt-falcon-7b-lora-4.5"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    torch_dtype=torch.bfloat16,
    trust_remote_code=True,
    device_map="auto",
)
sequences = pipeline(
   "Can you analyze the legal implications of the Ayodhya Verdict by the Supreme Court of India?",
    max_length=200,
    do_sample=True,
    top_k=10,
    num_return_sequences=1,
    temperature=0.5,
    eos_token_id=tokenizer.eos_token_id,
    pad_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
    print(f"Result: {seq['generated_text']}")

```