Text Generation
Transformers
Safetensors
English
llama
legal
finance
small-language-model
text-generation-inference
Instructions to use sumitguha13/slm125MLIVE-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sumitguha13/slm125MLIVE-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sumitguha13/slm125MLIVE-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sumitguha13/slm125MLIVE-base") model = AutoModelForCausalLM.from_pretrained("sumitguha13/slm125MLIVE-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sumitguha13/slm125MLIVE-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sumitguha13/slm125MLIVE-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sumitguha13/slm125MLIVE-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sumitguha13/slm125MLIVE-base
- SGLang
How to use sumitguha13/slm125MLIVE-base 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 "sumitguha13/slm125MLIVE-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sumitguha13/slm125MLIVE-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "sumitguha13/slm125MLIVE-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sumitguha13/slm125MLIVE-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sumitguha13/slm125MLIVE-base with Docker Model Runner:
docker model run hf.co/sumitguha13/slm125MLIVE-base
Upload slm125MLIVE-base (weights + tokenizer)
Browse files- README.md +48 -0
- config.json +29 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
- special_tokens_map.json +11 -0
- tokenizer.json +0 -0
- tokenizer_config.json +72 -0
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: odc-by
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- legal
|
| 9 |
+
- finance
|
| 10 |
+
- llama
|
| 11 |
+
- small-language-model
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# slm125MLIVE-base
|
| 15 |
+
|
| 16 |
+
A 125M-parameter LLaMA-architecture small language model pretrained from scratch
|
| 17 |
+
on a legal + financial corpus. Base model (no instruction tuning).
|
| 18 |
+
|
| 19 |
+
## Model
|
| 20 |
+
- Architecture: LLaMA (transformers `LlamaForCausalLM`), 12 layers / 768 hidden /
|
| 21 |
+
12 heads (MHA), SwiGLU, RoPE, RMSNorm, tied embeddings.
|
| 22 |
+
- Params: ~125.8M. Context length: 1024. Vocab: 16,384 (byte-level BPE trained
|
| 23 |
+
on this corpus).
|
| 24 |
+
|
| 25 |
+
## Training data (~2.04B tokens, 1 epoch)
|
| 26 |
+
Legal-first mix, cleaned / deduplicated / decontaminated:
|
| 27 |
+
- `HFforLegal/case-law` (US court opinions) — ~40%
|
| 28 |
+
- `PleIAs/SEC` (SEC filings) — ~40%
|
| 29 |
+
- `HuggingFaceFW/fineweb-edu` (educational web) — ~20%
|
| 30 |
+
|
| 31 |
+
Decontaminated against CaseHOLD / LexGLUE (13-gram overlap removal).
|
| 32 |
+
|
| 33 |
+
## Results
|
| 34 |
+
- Validation perplexity: **10.44** (full held-out set, 20.56M tokens).
|
| 35 |
+
- Final val loss: 2.346. Trained 3,889 steps at a 524,288-token global batch.
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
```python
|
| 39 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 40 |
+
tok = AutoTokenizer.from_pretrained("sumitguha13/slm125MLIVE-base")
|
| 41 |
+
model = AutoModelForCausalLM.from_pretrained("sumitguha13/slm125MLIVE-base")
|
| 42 |
+
ids = tok("<|bos|>The plaintiff shall bear the burden of", return_tensors="pt").input_ids
|
| 43 |
+
print(tok.decode(model.generate(ids, max_new_tokens=60)[0], skip_special_tokens=True))
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Limitations
|
| 47 |
+
Base model: generates fluent, domain-appropriate text but invents facts and does
|
| 48 |
+
not follow instructions. Not for production or legal/financial advice.
|
config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"eos_token_id": 2,
|
| 9 |
+
"head_dim": 64,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 768,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 3072,
|
| 14 |
+
"max_position_embeddings": 1024,
|
| 15 |
+
"mlp_bias": false,
|
| 16 |
+
"model_type": "llama",
|
| 17 |
+
"num_attention_heads": 12,
|
| 18 |
+
"num_hidden_layers": 12,
|
| 19 |
+
"num_key_value_heads": 12,
|
| 20 |
+
"pretraining_tp": 1,
|
| 21 |
+
"rms_norm_eps": 1e-05,
|
| 22 |
+
"rope_scaling": null,
|
| 23 |
+
"rope_theta": 10000.0,
|
| 24 |
+
"tie_word_embeddings": true,
|
| 25 |
+
"torch_dtype": "float32",
|
| 26 |
+
"transformers_version": "4.46.3",
|
| 27 |
+
"use_cache": true,
|
| 28 |
+
"vocab_size": 16384
|
| 29 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"transformers_version": "4.46.3"
|
| 6 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b99aba3edc20ad46699ec89fa93cb578e61ed6c08d1a7a563b0e994fdd4767c
|
| 3 |
+
size 503405488
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|user|>",
|
| 4 |
+
"<|assistant|>",
|
| 5 |
+
"<|system|>"
|
| 6 |
+
],
|
| 7 |
+
"bos_token": "<|bos|>",
|
| 8 |
+
"eos_token": "<|eos|>",
|
| 9 |
+
"pad_token": "<|pad|>",
|
| 10 |
+
"unk_token": "<|unk|>"
|
| 11 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<|bos|>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<|eos|>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "<|pad|>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "<|unk|>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"4": {
|
| 36 |
+
"content": "<|user|>",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
},
|
| 43 |
+
"5": {
|
| 44 |
+
"content": "<|assistant|>",
|
| 45 |
+
"lstrip": false,
|
| 46 |
+
"normalized": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"special": true
|
| 50 |
+
},
|
| 51 |
+
"6": {
|
| 52 |
+
"content": "<|system|>",
|
| 53 |
+
"lstrip": false,
|
| 54 |
+
"normalized": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"special": true
|
| 58 |
+
}
|
| 59 |
+
},
|
| 60 |
+
"additional_special_tokens": [
|
| 61 |
+
"<|user|>",
|
| 62 |
+
"<|assistant|>",
|
| 63 |
+
"<|system|>"
|
| 64 |
+
],
|
| 65 |
+
"bos_token": "<|bos|>",
|
| 66 |
+
"clean_up_tokenization_spaces": false,
|
| 67 |
+
"eos_token": "<|eos|>",
|
| 68 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 69 |
+
"pad_token": "<|pad|>",
|
| 70 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 71 |
+
"unk_token": "<|unk|>"
|
| 72 |
+
}
|