veriga commited on
Commit
f58782e
·
verified ·
1 Parent(s): e717a82

Delete openwebtext-gemma3-tokenized-1024-activations-layer23.py

Browse files
openwebtext-gemma3-tokenized-1024-activations-layer23.py DELETED
@@ -1,48 +0,0 @@
1
- import numpy as np
2
- import glob
3
- import datasets
4
-
5
-
6
- _DESCRIPTION = """\
7
- Precomputed hidden state activations from layer 23 of Gemma-3-1B-IT
8
- for the OpenWebText dataset, tokenized with sequence length 1024.
9
- Designed for training a Titans memory layer.
10
- """
11
-
12
- _SHARD_BASE = "shard_[0-9]*.npy"
13
-
14
-
15
- class OpenwebtextGemma3Tokenized1024ActivationsLayer23(datasets.GeneratorBasedBuilder):
16
- VERSION = datasets.Version("1.0.0")
17
-
18
- def _info(self):
19
- return datasets.DatasetInfo(
20
- description=_DESCRIPTION,
21
- features=datasets.Features({
22
- "activations": datasets.Array3D(shape=(1024, 3072), dtype="float32"),
23
- "mask": datasets.Array2D(shape=(1024,), dtype="int32"),
24
- "tokens": datasets.Array2D(shape=(1024,), dtype="int32"),
25
- }),
26
- )
27
-
28
- def _split_generators(self, dl_manager):
29
- all_npy = sorted(glob.glob(_SHARD_BASE))
30
- shards = [f for f in all_npy
31
- if not f.endswith("_masks.npy") and not f.endswith("_tokens.npy")]
32
- return [datasets.SplitGenerator(
33
- name=datasets.Split.TRAIN,
34
- gen_kwargs={"shard_files": shards},
35
- )]
36
-
37
- def _generate_examples(self, shard_files):
38
- for shard_path in shard_files:
39
- shard_id = shard_path.split("shard_")[1].split(".npy")[0]
40
- act = np.load(shard_path).astype(np.float32)
41
- mask = np.load(shard_path.replace(".npy", "_masks.npy"))
42
- tokens = np.load(shard_path.replace(".npy", "_tokens.npy"))
43
- for i in range(act.shape[0]):
44
- yield f"{shard_id}_{i}", {
45
- "activations": act[i],
46
- "mask": mask[i],
47
- "tokens": tokens[i],
48
- }