analyticspro commited on
Commit
12c39bc
·
verified ·
1 Parent(s): bfe576f

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - llama
7
+ - small-language-model
8
+ - pretrained-from-scratch
9
+ - legal
10
+ ---
11
+
12
+ # slm-125m-base
13
+
14
+ A **125.8M-parameter** Llama-shaped language model pretrained
15
+ **from scratch** on a legal-first corpus (US case law + SEC filings + a slice of
16
+ FineWeb-Edu). Built with a custom 16,384-token BPE tokenizer.
17
+
18
+ This is a **base / foundation** model -- it does next-token continuation, not
19
+ instruction following or chat. Expect rough, domain-flavored completions; it was
20
+ trained on a small budget (step 5,000, ~2.62B tokens seen).
21
+
22
+ ## Architecture
23
+
24
+ | | |
25
+ |---|---|
26
+ | Params | ~125.8M (tied embeddings) |
27
+ | Layers | 12 |
28
+ | Hidden size | 768 |
29
+ | Heads / KV heads | 12 / 12 (MHA) |
30
+ | Context length | 1,024 |
31
+ | Vocab | 16,384 (custom BPE) |
32
+ | Activation | SwiGLU (silu) |
33
+ | Position | RoPE (theta 10000) |
34
+
35
+ ## Usage
36
+
37
+ ```python
38
+ from transformers import AutoModelForCausalLM, AutoTokenizer
39
+ import torch
40
+
41
+ tok = AutoTokenizer.from_pretrained("analyticspro/slm-125m-base")
42
+ model = AutoModelForCausalLM.from_pretrained("analyticspro/slm-125m-base")
43
+ model.eval()
44
+
45
+ ids = tok("The court held that", return_tensors="pt")
46
+ out = model.generate(**ids, max_new_tokens=120, do_sample=True,
47
+ temperature=0.8, top_p=0.95,
48
+ pad_token_id=tok.eos_token_id)
49
+ print(tok.decode(out[0], skip_special_tokens=True))
50
+ ```
51
+
52
+ ## Limitations
53
+
54
+ Small model, small pretraining budget, and a legal-heavy corpus: outputs can be
55
+ factually wrong, repetitive, or biased toward legal/regulatory phrasing. Not
56
+ suitable for production or any high-stakes use. For research and demos only.
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 0,
8
+ "eos_token_id": 1,
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
+ "pad_token_id": 2,
21
+ "pretraining_tp": 1,
22
+ "rms_norm_eps": 1e-05,
23
+ "rope_scaling": null,
24
+ "rope_theta": 10000.0,
25
+ "tie_word_embeddings": true,
26
+ "torch_dtype": "float32",
27
+ "transformers_version": "4.46.3",
28
+ "use_cache": true,
29
+ "vocab_size": 16384
30
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "do_sample": true,
5
+ "eos_token_id": 1,
6
+ "max_new_tokens": 120,
7
+ "pad_token_id": 2,
8
+ "temperature": 0.8,
9
+ "top_p": 0.95,
10
+ "transformers_version": "4.46.3"
11
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7719b74a0f0e4b9abc9292875ec35146559d0fd66aeda25708dae4877062a7d7
3
+ size 503405488
special_tokens_map.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|user|>",
4
+ "<|assistant|>",
5
+ "<|system|>"
6
+ ],
7
+ "bos_token": {
8
+ "content": "<|bos|>",
9
+ "lstrip": false,
10
+ "normalized": false,
11
+ "rstrip": false,
12
+ "single_word": false
13
+ },
14
+ "eos_token": {
15
+ "content": "<|eos|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "pad_token": {
22
+ "content": "<|pad|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ },
28
+ "unk_token": {
29
+ "content": "<|unk|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ }
35
+ }
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
+ }