lennartcb commited on
Commit
950d083
·
verified ·
1 Parent(s): 66cece9

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - pflm1
7
+ - prior-fitted-networks
8
+ - in-context-learning
9
+ - byte-level
10
+ ---
11
+
12
+ # PFLM1
13
+
14
+ PFLM1 is a 300M parameter byte-level model pretrained only on samples from a
15
+ synthetic non-linguistic prior. Given a prefix of a structured byte sequence
16
+ like natural language, the model infers the source in context and predicts
17
+ what comes next.
18
+
19
+ This repository holds the weights and their configuration. The model code,
20
+ the byte-level API, and the prior are at https://github.com/cbl/pflm1.
21
+
22
+ ## Quickstart
23
+
24
+ ```sh
25
+ pip install "pflm1[hf]"
26
+ ```
27
+
28
+ ```python
29
+ import pflm1
30
+ from transformers import AutoModelForCausalLM
31
+
32
+ model = AutoModelForCausalLM.from_pretrained("lennartcb/pflm1", dtype="bfloat16").cuda().eval()
33
+
34
+ def primes(n): # 1 where the integer is prime, else 0
35
+ flags = bytearray([1]) * n
36
+ flags[:2] = b"\0\0"
37
+ for i in range(2, int(n ** 0.5) + 1):
38
+ if flags[i]:
39
+ flags[i * i::i] = bytes(len(flags[i * i::i]))
40
+ return bytes(48 + f for f in flags)
41
+
42
+ text = primes(10_000) # "0011010100..." ten thousand digits
43
+ bits = model.bits_per_byte(text) # bits per byte, one entry each
44
+ print(bits[:500].mean(), bits[-500:].mean()) # the first 500 digits vs. the last 500
45
+ ```
46
+
47
+ Importing `pflm1` registers the architecture with `transformers`. The
48
+ model consumes raw bytes: `bits_per_byte` scores a byte string,
49
+ `model.stream()` scores bytes as they arrive with the state carried, and
50
+ `model.generate_bytes(context)` samples a continuation. `AutoTokenizer`
51
+ maps each UTF-8 byte to its own id and adds no special tokens.
52
+
53
+ ## Citation
54
+
55
+ ```bibtex
56
+ @article{pflm1,
57
+ title = {Learning to Learn a Language},
58
+ author = {Carstens-Behrens, Lennart and Fr{\"o}hlich, Holger},
59
+ year = {2026},
60
+ }
61
+ ```
config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Pflm1ForCausalLM"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "head_dim": 128,
7
+ "hidden_size": 1024,
8
+ "initializer_range": 0.02,
9
+ "intermediate_size": 2048,
10
+ "layer_types": [
11
+ "linear_attention",
12
+ "linear_attention",
13
+ "linear_attention",
14
+ "sliding_attention",
15
+ "linear_attention",
16
+ "linear_attention",
17
+ "linear_attention",
18
+ "sliding_attention",
19
+ "linear_attention",
20
+ "linear_attention",
21
+ "linear_attention",
22
+ "sliding_attention",
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "linear_attention",
26
+ "sliding_attention",
27
+ "linear_attention",
28
+ "linear_attention",
29
+ "linear_attention",
30
+ "sliding_attention"
31
+ ],
32
+ "layers": [
33
+ "gdn",
34
+ "gdn",
35
+ "gdn",
36
+ "swa"
37
+ ],
38
+ "linear_conv_kernel_dim": 4,
39
+ "linear_key_head_dim": 128,
40
+ "linear_num_key_heads": 8,
41
+ "linear_num_value_heads": 16,
42
+ "linear_value_head_dim": 128,
43
+ "model_type": "pflm1",
44
+ "num_attention_heads": 16,
45
+ "num_hidden_layers": 20,
46
+ "num_key_value_heads": 8,
47
+ "rms_norm_eps": 1e-06,
48
+ "rope_theta": 500000.0,
49
+ "rotary_dim": 32,
50
+ "sliding_window": 262144,
51
+ "tie_word_embeddings": false,
52
+ "transformers_version": "5.15.1",
53
+ "use_cache": true,
54
+ "vocab_size": 256
55
+ }
generation_config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "transformers_version": "5.15.1",
4
+ "use_cache": true
5
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:385b7b21cae8605dbc4fe0611b6a78576017260824011a0cbe402e3014061c0e
3
+ size 589843368
tokenizer_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {},
3
+ "backend": "custom",
4
+ "clean_up_tokenization_spaces": false,
5
+ "model_max_length": 1000000000000000019884624838656,
6
+ "tokenizer_class": "Pflm1Tokenizer"
7
+ }