BioMike commited on
Commit
9ab305e
·
verified ·
1 Parent(s): 447f619

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: google/t5gemma-2-270m-270m
3
+ license: gemma
4
+ tags:
5
+ - gemma2
6
+ - encoder-only
7
+ - text-encoder
8
+ - embeddings
9
+ - bidirectional
10
+ ---
11
+
12
+ # T5Gemma-2-270m — Text Encoder Only (Bidirectional)
13
+
14
+ Text encoder extracted from [google/t5gemma-2-270m-270m](https://huggingface.co/google/t5gemma-2-270m-270m),
15
+ saved as standard `Gemma2Model` with **bidirectional attention** (`is_decoder=False`).
16
+
17
+ > Gemma is provided under and subject to the Gemma Terms of Use found at https://ai.google.dev/gemma/terms
18
+
19
+ ## Architecture
20
+ - 18 layers, hidden_size=640, heads=4
21
+ - Sliding window attention (512) + full attention every 6 layers
22
+ - Bidirectional (no causal mask)
23
+ - Parameters: 268M
24
+
25
+ ## Usage
26
+ ```python
27
+ from transformers import AutoModel, AutoTokenizer
28
+
29
+ model = AutoModel.from_pretrained("knowledgator/t5gemma-2-text-encoder-270m")
30
+ tokenizer = AutoTokenizer.from_pretrained("knowledgator/t5gemma-2-text-encoder-270m")
31
+
32
+ inputs = tokenizer("Your text here", return_tensors="pt", padding=True, truncation=True)
33
+ outputs = model(**inputs)
34
+
35
+ token_embeddings = outputs.last_hidden_state # (batch, seq_len, 640)
36
+ pooled = outputs.last_hidden_state.mean(1) # mean pooling -> (batch, 640)
37
+ ```
config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma2Model"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attn_logit_softcapping": null,
8
+ "bos_token_id": 2,
9
+ "dtype": "float32",
10
+ "eos_token_id": 1,
11
+ "final_logit_softcapping": null,
12
+ "head_dim": 256,
13
+ "hidden_activation": "gelu_pytorch_tanh",
14
+ "hidden_size": 640,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 2048,
17
+ "is_decoder": false,
18
+ "layer_types": [
19
+ "sliding_attention",
20
+ "full_attention",
21
+ "sliding_attention",
22
+ "full_attention",
23
+ "sliding_attention",
24
+ "full_attention",
25
+ "sliding_attention",
26
+ "full_attention",
27
+ "sliding_attention",
28
+ "full_attention",
29
+ "sliding_attention",
30
+ "full_attention",
31
+ "sliding_attention",
32
+ "full_attention",
33
+ "sliding_attention",
34
+ "full_attention",
35
+ "sliding_attention",
36
+ "full_attention"
37
+ ],
38
+ "max_position_embeddings": 32768,
39
+ "model_type": "gemma2",
40
+ "num_attention_heads": 4,
41
+ "num_hidden_layers": 18,
42
+ "num_key_value_heads": 1,
43
+ "pad_token_id": 0,
44
+ "query_pre_attn_scalar": 256,
45
+ "rms_norm_eps": 1e-06,
46
+ "rope_parameters": {
47
+ "rope_theta": 10000,
48
+ "rope_type": "default"
49
+ },
50
+ "sliding_window": 512,
51
+ "tie_word_embeddings": true,
52
+ "transformers_version": "5.3.0.dev0",
53
+ "use_bidirectional_attention": null,
54
+ "use_cache": true,
55
+ "vocab_size": 262144
56
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36e3f29bb9c10785f51d6ba285c58ebd8aba6434e1741ca96d37cbe45b70b7d9
3
+ size 1072377272
text_encoder_weights.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb5f372cb57300ba2f3b0f19291b36e3f54b6eaa5d8236418e3f5ce29d56edd8
3
+ size 536291708
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5b325224482ec441ec5fbe2a5ac08c3758e0f9605f6e54368e31f736fcfb01d
3
+ size 33384387
tokenizer_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "boi_token": "<start_of_image>",
4
+ "bos_token": "<bos>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eoi_token": "<end_of_image>",
7
+ "eos_token": "<eos>",
8
+ "extra_special_tokens": [],
9
+ "image_token": "<image_soft_token>",
10
+ "is_local": false,
11
+ "mask_token": "<mask>",
12
+ "model_max_length": 1000000000000000019884624838656,
13
+ "model_specific_special_tokens": {
14
+ "boi_token": "<start_of_image>",
15
+ "eoi_token": "<end_of_image>",
16
+ "image_token": "<image_soft_token>"
17
+ },
18
+ "pad_token": "<pad>",
19
+ "padding_side": "right",
20
+ "processor_class": "Gemma3Processor",
21
+ "sp_model_kwargs": null,
22
+ "spaces_between_special_tokens": false,
23
+ "tokenizer_class": "GemmaTokenizer",
24
+ "unk_token": "<unk>",
25
+ "use_default_system_prompt": false
26
+ }