Instructions to use profullstack/not-a-lawyer-agent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use profullstack/not-a-lawyer-agent with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct") model = PeftModel.from_pretrained(base_model, "profullstack/not-a-lawyer-agent") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from profullstack/not-a-lawyer-agent: direct link, hf CLI and curl.
- Browser
- Download file 2.86 kB
-
https://huggingface.co/profullstack/not-a-lawyer-agent/resolve/main/README.md
- Command line
-
hf download hf://profullstack/not-a-lawyer-agent/README.md
-
curl -L -o README.md https://huggingface.co/profullstack/not-a-lawyer-agent/resolve/main/README.md
2.86 kB
| base_model: Qwen/Qwen2.5-0.5B-Instruct | |
| library_name: peft | |
| pipeline_tag: text-generation | |
| license: apache-2.0 | |
| tags: [lora, peft, legal, law, legal-research, cpu, c0mpute, ollama] | |
| # not-a-lawyer-agent | |
| > **Not a lawyer. Not legal advice. Legal research from public sources; laws vary by jurisdiction, so check with a licensed attorney before acting.** | |
| **Quick start (Ollama, runs on a CPU):** | |
| ```bash | |
| ollama run hf.co/profullstack/not-a-lawyer-agent-GGUF "Can my landlord keep my whole security deposit for normal wear and tear?" | |
| ``` | |
| Needs Ollama 0.3.13 or newer (`curl -fsSL https://ollama.com/install.sh | sh`, or `w3bs install ollama`). | |
| The GGUF is at [profullstack/not-a-lawyer-agent-GGUF](https://huggingface.co/profullstack/not-a-lawyer-agent-GGUF); this repo is the LoRA adapter. | |
| | | | | |
| | --- | --- | | |
| | base | Qwen/Qwen2.5-0.5B-Instruct | | |
| | corpus | 5963 documents from pit-index:law,legal,lawyer,lawsuit,court ruling,contract law,copyright,tenant rights,employment law,small claims, topic:law, topic:legal, topic:lawyer, topic:lawsuit, topic:court, topic:copyright, topic:contract-law, topic:legal-tech | | |
| | training | 400 LoRA steps (r=8, seq_len=256, lr=0.0002) on the c0mpute network (`infernet.text.train`, job `3088dff7-b5a6-4969-a40e-5d250d6fa920`, receipt hash `sha256:88140d7fe1c84b0bd03cc4b70838caef984c80d702d470e88595b08a22552ed6` matches this adapter) | | |
| | held-out perplexity | 35.4 to 20.6 | | |
| | adapter sha256 | `88140d7fe1c84b0bd03cc4b70838caef984c80d702d470e88595b08a22552ed6` | | |
| Built with the [c0mpute example](https://github.com/profullstack/c0mpute/tree/master/examples/business-strategist-agent). | |
| Sources are rssamplifier.com topic feeds and pit.world search; the corpus is not redistributed here. | |
| ## Use from Python (adapter) | |
| ```python | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| tok = AutoTokenizer.from_pretrained("profullstack/not-a-lawyer-agent") | |
| model = PeftModel.from_pretrained(AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct"), "profullstack/not-a-lawyer-agent") | |
| msgs = [{"role": "system", "content": "You are not-a-lawyer-agent, a legal research assistant. You are not a lawyer and this is not legal advice. Explain the law in plain English, name the jurisdiction a rule comes from, cite the sources you were given, and say when someone should talk to a licensed attorney."}, | |
| {"role": "user", "content": "Can my landlord keep my whole security deposit for normal wear and tear?"}] | |
| ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt") | |
| print(tok.decode(model.generate(ids, max_new_tokens=300)[0][ids.shape[1]:], skip_special_tokens=True)) | |
| ``` | |
| Best results come from putting fresh search results in the prompt (the example's `chat.py` | |
| uses pit.world search): a sub-1B model supplies the voice, not the facts. | |