Text Generation
Transformers
Safetensors
PEFT
English
legal-ai
lora
qlora
indian-law
legal-simplification
accessibility
irac
unsloth
conversational
Instructions to use joyboseroy/nyayasaar-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use joyboseroy/nyayasaar-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="joyboseroy/nyayasaar-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("joyboseroy/nyayasaar-lora", dtype="auto") - PEFT
How to use joyboseroy/nyayasaar-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use joyboseroy/nyayasaar-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "joyboseroy/nyayasaar-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "joyboseroy/nyayasaar-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/joyboseroy/nyayasaar-lora
- SGLang
How to use joyboseroy/nyayasaar-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "joyboseroy/nyayasaar-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "joyboseroy/nyayasaar-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "joyboseroy/nyayasaar-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "joyboseroy/nyayasaar-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use joyboseroy/nyayasaar-lora with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for joyboseroy/nyayasaar-lora to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for joyboseroy/nyayasaar-lora to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for joyboseroy/nyayasaar-lora to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="joyboseroy/nyayasaar-lora", max_seq_length=2048, ) - Docker Model Runner
How to use joyboseroy/nyayasaar-lora with Docker Model Runner:
docker model run hf.co/joyboseroy/nyayasaar-lora
Update README
Browse files
README.md
CHANGED
|
@@ -127,6 +127,48 @@ This project is intended for:
|
|
| 127 |
|
| 128 |
---
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
# Limitations
|
| 131 |
|
| 132 |
This model:
|
|
|
|
| 127 |
|
| 128 |
---
|
| 129 |
|
| 130 |
+
# Usage
|
| 131 |
+
|
| 132 |
+
```python
|
| 133 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 134 |
+
from peft import PeftModel
|
| 135 |
+
|
| 136 |
+
base_model = "Qwen/Qwen2.5-0.5B-Instruct"
|
| 137 |
+
adapter_model = "joyboseroy/nyayasaar-lora"
|
| 138 |
+
|
| 139 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model)
|
| 140 |
+
|
| 141 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 142 |
+
base_model,
|
| 143 |
+
device_map="auto"
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
model = PeftModel.from_pretrained(model, adapter_model)
|
| 147 |
+
|
| 148 |
+
prompt = """
|
| 149 |
+
Issue: Whether the detention order violates Article 22.
|
| 150 |
+
|
| 151 |
+
Rule: Preventive detention laws require procedural safeguards.
|
| 152 |
+
|
| 153 |
+
Application: The petitioner argued safeguards were not followed.
|
| 154 |
+
|
| 155 |
+
Conclusion: The detention order is quashed.
|
| 156 |
+
"""
|
| 157 |
+
|
| 158 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 159 |
+
|
| 160 |
+
outputs = model.generate(
|
| 161 |
+
**inputs,
|
| 162 |
+
max_new_tokens=200
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 166 |
+
````
|
| 167 |
+
|
| 168 |
+
```
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
|
| 172 |
# Limitations
|
| 173 |
|
| 174 |
This model:
|