IMvision12 commited on
Commit
1bbb63c
·
verified ·
1 Parent(s): c7c9643

Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)

Browse files
Files changed (2) hide show
  1. README.md +15 -15
  2. kf_config.json → zm_config.json +20 -20
README.md CHANGED
@@ -2,12 +2,12 @@
2
  pipeline_tag: text-generation
3
  license: mit
4
  base_model: openai-community/gpt2-large
5
- library_name: kerasformers
6
  language:
7
  - en
8
  tags:
9
  - keras
10
- - kerasformers
11
  - gpt2
12
  - gpt-2
13
  - text-generation
@@ -18,9 +18,9 @@ tags:
18
 
19
  # Run GPT-2 with Keras 3: JAX, PyTorch, or TensorFlow
20
 
21
- [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-black?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-GPT--2-blue)](https://imvision12.github.io/KerasFormers/gpt2/)
22
 
23
- # kerasformers/gpt2_large
24
 
25
  Paper: [Language Models are Unsupervised Multitask Learners (Radford et al., 2019)](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
26
 
@@ -32,7 +32,7 @@ activations, a tied output head, and a byte-level BPE tokenizer. This is the
32
  For more details, see the upstream [model card](https://huggingface.co/openai-community/gpt2-large).
33
 
34
  Pure-**Keras 3** conversion of [`openai-community/gpt2-large`](https://huggingface.co/openai-community/gpt2-large) for
35
- [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on
36
  **TensorFlow / Torch / JAX**.
37
 
38
  ## Quick start
@@ -41,31 +41,31 @@ Pure-**Keras 3** conversion of [`openai-community/gpt2-large`](https://huggingfa
41
  import os
42
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
43
 
44
- from kerasformers.models.gpt2 import GPT2TextGenerate, GPT2Tokenizer
45
 
46
- model = GPT2TextGenerate.from_weights("kerasformers/gpt2_large")
47
- tokenizer = GPT2Tokenizer.from_weights("kerasformers/gpt2_large")
48
 
49
  inputs = tokenizer("The meaning of life is")
50
  outputs = model.generate(**inputs, max_new_tokens=40)
51
  print(tokenizer.decode(outputs[0]))
52
  ```
53
 
54
- All GPT-2 sizes load the same way with `from_weights("kerasformers/<variant>")`:
55
 
56
  | Variant | Hub | Params |
57
  |---|---|---|
58
- | `gpt2` | [`kerasformers/gpt2`](https://huggingface.co/kerasformers/gpt2) | 124M |
59
- | `gpt2_medium` | [`kerasformers/gpt2_medium`](https://huggingface.co/kerasformers/gpt2_medium) | 355M |
60
- | `gpt2_large` | [`kerasformers/gpt2_large`](https://huggingface.co/kerasformers/gpt2_large) | 774M |
61
- | `gpt2_xl` | [`kerasformers/gpt2_xl`](https://huggingface.co/kerasformers/gpt2_xl) | 1.5B |
62
 
63
  ## Tips
64
 
65
- - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
66
  - This is a base completion model: it continues a prompt and is not
67
  instruction-tuned.
68
- - See the [GPT-2 docs](https://imvision12.github.io/KerasFormers/gpt2/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
69
  - Upstream safetensors still work via the `hf:` prefix, e.g.
70
  `GPT2TextGenerate.from_weights("hf:openai-community/gpt2-large")`.
71
 
 
2
  pipeline_tag: text-generation
3
  license: mit
4
  base_model: openai-community/gpt2-large
5
+ library_name: zeromodels
6
  language:
7
  - en
8
  tags:
9
  - keras
10
+ - zeromodels
11
  - gpt2
12
  - gpt-2
13
  - text-generation
 
18
 
19
  # Run GPT-2 with Keras 3: JAX, PyTorch, or TensorFlow
20
 
21
+ [![GitHub](https://img.shields.io/badge/GitHub-ZeroModels-black?logo=github)](https://github.com/IMvision12/ZeroModels) [![Docs](https://img.shields.io/badge/Docs-GPT--2-blue)](https://imvision12.github.io/ZeroModels/gpt2/)
22
 
23
+ # zeromodels/gpt2_large
24
 
25
  Paper: [Language Models are Unsupervised Multitask Learners (Radford et al., 2019)](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
26
 
 
32
  For more details, see the upstream [model card](https://huggingface.co/openai-community/gpt2-large).
33
 
34
  Pure-**Keras 3** conversion of [`openai-community/gpt2-large`](https://huggingface.co/openai-community/gpt2-large) for
35
+ [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on
36
  **TensorFlow / Torch / JAX**.
37
 
38
  ## Quick start
 
41
  import os
42
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
43
 
44
+ from zeromodels.models.gpt2 import GPT2TextGenerate, GPT2Tokenizer
45
 
46
+ model = GPT2TextGenerate.from_weights("zeromodels/gpt2_large")
47
+ tokenizer = GPT2Tokenizer.from_weights("zeromodels/gpt2_large")
48
 
49
  inputs = tokenizer("The meaning of life is")
50
  outputs = model.generate(**inputs, max_new_tokens=40)
51
  print(tokenizer.decode(outputs[0]))
52
  ```
53
 
54
+ All GPT-2 sizes load the same way with `from_weights("zeromodels/<variant>")`:
55
 
56
  | Variant | Hub | Params |
57
  |---|---|---|
58
+ | `gpt2` | [`zeromodels/gpt2`](https://huggingface.co/zeromodels/gpt2) | 124M |
59
+ | `gpt2_medium` | [`zeromodels/gpt2_medium`](https://huggingface.co/zeromodels/gpt2_medium) | 355M |
60
+ | `gpt2_large` | [`zeromodels/gpt2_large`](https://huggingface.co/zeromodels/gpt2_large) | 774M |
61
+ | `gpt2_xl` | [`zeromodels/gpt2_xl`](https://huggingface.co/zeromodels/gpt2_xl) | 1.5B |
62
 
63
  ## Tips
64
 
65
+ - Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
66
  - This is a base completion model: it continues a prompt and is not
67
  instruction-tuned.
68
+ - See the [GPT-2 docs](https://imvision12.github.io/ZeroModels/gpt2/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
69
  - Upstream safetensors still work via the `hf:` prefix, e.g.
70
  `GPT2TextGenerate.from_weights("hf:openai-community/gpt2-large")`.
71
 
kf_config.json → zm_config.json RENAMED
@@ -1,21 +1,21 @@
1
- {
2
- "library_name": "kerasformers",
3
- "kerasformers_version": "1.2.1",
4
- "model_module": "kerasformers.models.gpt2",
5
- "model_class": "GPT2Model",
6
- "variant": "gpt2_large",
7
- "weights": "model.weights.json",
8
- "schema_version": 2,
9
- "weight_dtype": "float32",
10
- "model_type": "gpt2",
11
- "text_config": {
12
- "vocab_size": 50257,
13
- "embed_dim": 1280,
14
- "mlp_dim": 5120,
15
- "num_layers": 36,
16
- "num_heads": 20,
17
- "max_position_embeddings": 1024,
18
- "norm_eps": 1e-05,
19
- "tie_embeddings": true
20
- }
21
  }
 
1
+ {
2
+ "library_name": "zeromodels",
3
+ "zeromodels_version": "1.2.1",
4
+ "model_module": "zeromodels.models.gpt2",
5
+ "model_class": "GPT2Model",
6
+ "variant": "gpt2_large",
7
+ "weights": "model.weights.json",
8
+ "schema_version": 2,
9
+ "weight_dtype": "float32",
10
+ "model_type": "gpt2",
11
+ "text_config": {
12
+ "vocab_size": 50257,
13
+ "embed_dim": 1280,
14
+ "mlp_dim": 5120,
15
+ "num_layers": 36,
16
+ "num_heads": 20,
17
+ "max_position_embeddings": 1024,
18
+ "norm_eps": 1e-05,
19
+ "tie_embeddings": true
20
+ }
21
  }