varma007ut commited on
Commit
ce34b93
1 Parent(s): b1f1f6e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -49
README.md CHANGED
@@ -11,81 +11,137 @@ tags:
11
  - trl
12
  - sft
13
  ---
14
- Indian Legal Assistant: A LLaMA-based Model for Indian Legal Text Generation
15
- This repository contains information and code for the Indian Legal Assistant, a LLaMA-based model finetuned on Indian legal texts. The model is designed to assist with various legal tasks and queries related to Indian law.
16
-
17
- Table of Contents
18
- Model Description
19
- Model Details
20
- Installation
21
- Usage
22
- Evaluation
23
- Contributing
24
- License
25
- Model Description
26
- The Indian Legal Assistant is a text generation model specifically trained to understand and generate text related to Indian law. It is suitable for various legal tasks such as:
27
-
28
- Legal question answering
29
- Case summarization
30
- Legal document analysis
31
- Statute interpretation
32
- Model Details
33
- Model Name: Indian_Legal_Assistant
34
- Developer: varma007ut
35
- Model Size: 8.03B parameters
36
- Architecture: LLaMA
37
- Language: English
38
- License: Apache 2.0
39
- Hugging Face Repository: varma007ut/Indian_Legal_Assistant
40
- Installation
41
- To use this model, install the required libraries:
42
-
43
- bash
44
- Copy code
 
 
 
 
 
 
 
 
 
45
  pip install transformers torch
46
  # For GGUF support
47
  pip install llama-cpp-python
48
- Usage
 
 
 
 
49
  There are several ways to use the Indian Legal Assistant model:
50
 
51
- 1. Using Hugging Face Pipeline
52
- python
53
- Copy code
54
  from transformers import pipeline
55
 
56
- pipe = pipeline("text-generation", model="varma007ut/Indian_Legal_Assistant")
57
 
58
  prompt = "Summarize the key points of the Indian Contract Act, 1872:"
59
  result = pipe(prompt, max_length=200)
60
  print(result[0]['generated_text'])
61
- 2. Using Hugging Face Transformers Directly
62
- python
63
- Copy code
 
 
 
64
  from transformers import AutoTokenizer, AutoModelForCausalLM
65
 
66
- tokenizer = AutoTokenizer.from_pretrained("varma007ut/Indian_Legal_Assistant")
67
- model = AutoModelForCausalLM.from_pretrained("varma007ut/Indian_Legal_Assistant")
68
 
69
  prompt = "What are the fundamental rights in the Indian Constitution?"
70
  inputs = tokenizer(prompt, return_tensors="pt")
71
  outputs = model.generate(**inputs, max_length=200)
72
  print(tokenizer.decode(outputs[0]))
73
- 3. Using GGUF Format with llama-cpp-python
74
- python
75
- Copy code
 
 
 
76
  from llama_cpp import Llama
77
 
78
  llm = Llama.from_pretrained(
79
- repo_id="varma007ut/Indian_Legal_Assistant",
80
  filename="ggml-model-q4_0.gguf", # Replace with the actual GGUF filename if different
81
  )
82
 
83
  response = llm.create_chat_completion(
84
- messages=[
85
- {"role": "user", "content": "Explain the concept of judicial review in India."}
 
 
 
86
  ]
87
  )
88
 
89
  print(response['choices'][0]['message']['content'])
90
- 4. Using Inference Endpoints
91
- This model supports Hugging Face Inference Endpoints. You can deploy the model and use it via API calls. Refer to the Hugging Face documentation for more information on setting up and using Inference Endpoints.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  - trl
12
  - sft
13
  ---
14
+ # Indian Legal Assistant: A LLaMA-based Model for Indian Legal Text Generation
15
+
16
+ This repository contains information and code for using the Indian Legal Assistant, a LLaMA-based model finetuned on Indian legal texts. This model is designed to assist with various legal tasks and queries related to Indian law.
17
+
18
+ ## Table of Contents
19
+
20
+ - [Model Description](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
21
+ - [Model Details](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
22
+ - [Installation](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
23
+ - [Usage](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
24
+ - [Evaluation](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
25
+ - [Contributing](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
26
+ - [License](https://www.notion.so/1030d0a0ba4180268747e79df12fd2d5?pvs=21)
27
+
28
+ ## Model Description
29
+
30
+ The Indian Legal Assistant is a text generation model specifically trained to understand and generate text related to Indian law. It can be used for tasks such as:
31
+
32
+ - Legal question answering
33
+ - Case summarization
34
+ - Legal document analysis
35
+ - Statute interpretation
36
+
37
+ ## Model Details
38
+
39
+ | Attribute | Value |
40
+ | --- | --- |
41
+ | Model Name | Indian_Legal_Assitant |
42
+ | Developer | varma007ut |
43
+ | Model Size | 8.03B parameters |
44
+ | Architecture | LLaMA |
45
+ | Language | English |
46
+ | License | Apache 2.0 |
47
+ | Hugging Face Repo | [varma007ut/Indian_Legal_Assitant](https://huggingface.co/varma007ut/Indian_Legal_Assitant) |
48
+
49
+ ## Installation
50
+
51
+ To use this model, you'll need to install the required libraries:
52
+
53
+ ```bash
54
  pip install transformers torch
55
  # For GGUF support
56
  pip install llama-cpp-python
57
+
58
+ ```
59
+
60
+ ## Usage
61
+
62
  There are several ways to use the Indian Legal Assistant model:
63
 
64
+ ### 1. Using Hugging Face Pipeline
65
+
66
+ ```python
67
  from transformers import pipeline
68
 
69
+ pipe = pipeline("text-generation", model="varma007ut/Indian_Legal_Assitant")
70
 
71
  prompt = "Summarize the key points of the Indian Contract Act, 1872:"
72
  result = pipe(prompt, max_length=200)
73
  print(result[0]['generated_text'])
74
+
75
+ ```
76
+
77
+ ### 2. Using Hugging Face Transformers directly
78
+
79
+ ```python
80
  from transformers import AutoTokenizer, AutoModelForCausalLM
81
 
82
+ tokenizer = AutoTokenizer.from_pretrained("varma007ut/Indian_Legal_Assitant")
83
+ model = AutoModelForCausalLM.from_pretrained("varma007ut/Indian_Legal_Assitant")
84
 
85
  prompt = "What are the fundamental rights in the Indian Constitution?"
86
  inputs = tokenizer(prompt, return_tensors="pt")
87
  outputs = model.generate(**inputs, max_length=200)
88
  print(tokenizer.decode(outputs[0]))
89
+
90
+ ```
91
+
92
+ ### 3. Using GGUF format with llama-cpp-python
93
+
94
+ ```python
95
  from llama_cpp import Llama
96
 
97
  llm = Llama.from_pretrained(
98
+ repo_id="varma007ut/Indian_Legal_Assitant",
99
  filename="ggml-model-q4_0.gguf", # Replace with the actual GGUF filename if different
100
  )
101
 
102
  response = llm.create_chat_completion(
103
+ messages = [
104
+ {
105
+ "role": "user",
106
+ "content": "Explain the concept of judicial review in India."
107
+ }
108
  ]
109
  )
110
 
111
  print(response['choices'][0]['message']['content'])
112
+
113
+ ```
114
+
115
+ ### 4. Using Inference Endpoints
116
+
117
+ This model supports Hugging Face Inference Endpoints. You can deploy the model and use it via API calls. Refer to the [Hugging Face documentation](https://huggingface.co/docs/inference-endpoints/index) for more information on setting up and using Inference Endpoints.
118
+
119
+ ## Evaluation
120
+
121
+ To evaluate the model's performance:
122
+
123
+ 1. Prepare a test set of Indian legal queries or tasks.
124
+ 2. Use standard NLP evaluation metrics such as perplexity, BLEU score, or task-specific metrics.
125
+
126
+ Example using BLEU score:
127
+
128
+ ```python
129
+ from datasets import load_metric
130
+
131
+ bleu = load_metric("bleu")
132
+ predictions = model.generate(encoded_input)
133
+ results = bleu.compute(predictions=predictions, references=references)
134
+
135
+ ```
136
+
137
+ ## Contributing
138
+
139
+ We welcome contributions to improve the model or extend its capabilities. Please see our [Contributing Guidelines](https://www.notion.so/CONTRIBUTING.md) for more details.
140
+
141
+ ## License
142
+
143
+ This project is licensed under the Apache 2.0 License. See the [LICENSE](https://www.notion.so/LICENSE) file for details.
144
+
145
+ ---
146
+
147
+ **Note:** While this model is based on the LLaMA architecture, it has been finetuned on Indian legal texts. Ensure compliance with all relevant licenses and terms of use when using this model.