Instructions to use DeependraVerma/legal-slm-125m-ultimate-sft-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use DeependraVerma/legal-slm-125m-ultimate-sft-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'DeependraVerma/legal-slm-125m-ultimate-sft-onnx');
legal-slm-125m-ultimate-sft-onnx
ONNX build of legal-slm-125m-ultimate-sft,
laid out for transformers.js so
the model runs entirely in the browser β no server, no API key, nothing
leaves the user's machine.
| file | size | notes |
|---|---|---|
onnx/model.onnx |
504 MB | fp32, highest quality |
onnx/model_quantized.onnx |
126 MB | dynamic int8, what the web demo loads |
Both were verified as part of this repo's own publish pipeline: loaded with
optimum.onnxruntime.ORTModelForCausalLM (CPU execution provider) and used to
generate a real completion before anything was uploaded, e.g.:
'1.9. The parties acknowledge that the services provided by the Service Provider are subject to this Agreement and that the Services are intended to be performed by the Service Provider for the benefit of the Client.\n\n1.9. The Service Provider agrees to perform the Services in a professional and work'
Usage
import { AutoTokenizer, AutoModelForCausalLM } from "@huggingface/transformers";
const repo = "DeependraVerma/legal-slm-125m-ultimate-sft-onnx";
const tokenizer = await AutoTokenizer.from_pretrained(repo);
const model = await AutoModelForCausalLM.from_pretrained(repo, { dtype: "q8" });
This model uses a custom chat format rather than a chat_template β build the
prompt as:
<|bos|><|system|>{system}<|user|>{question}<|assistant|>
and stop on <|eos|>. A full contract needs max_new_tokens of 600β1200.
What it is good at, and what it is not
Good at drafting contract clauses and full documents β NDAs, MSAs, termination and indemnification provisions.
Legal-reasoning benchmarks (CaseHOLD, MMLU-legal, LegalBench) sit near chance/majority-class, consistent with this project's earlier 125M models β this is a drafting aid, not a legal-reasoning engine, and output requires review by a qualified lawyer.
General-knowledge benchmarks: HellaSwag 0.3209,
ARC-Easy 0.5025, PIQA 0.6333
(0-shot, lm-evaluation-harness).
Full benchmark tables, training details and limitations are on the parent model card and the base model card.
License
MIT.
- Downloads last month
- 150
Model tree for DeependraVerma/legal-slm-125m-ultimate-sft-onnx
Base model
DeependraVerma/legal-slm-125m-ultimate-sft