jonathanagustin commited on
Commit
56f428d
1 Parent(s): e89401d

Delete run.py

Browse files
Files changed (1) hide show
  1. run.py +0 -72
run.py DELETED
@@ -1,72 +0,0 @@
1
- # Copyright 2024 X.AI Corp.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- import logging
16
-
17
- from model import LanguageModelConfig, TransformerConfig, QuantizedWeight8bit as QW8Bit
18
- from runners import InferenceRunner, ModelRunner, sample_from_model
19
-
20
-
21
- CKPT_PATH = "./checkpoints/"
22
-
23
-
24
- def main():
25
- grok_1_model = LanguageModelConfig(
26
- vocab_size=128 * 1024,
27
- pad_token=0,
28
- eos_token=2,
29
- sequence_len=8192,
30
- embedding_init_scale=1.0,
31
- output_multiplier_scale=0.5773502691896257,
32
- embedding_multiplier_scale=78.38367176906169,
33
- model=TransformerConfig(
34
- emb_size=48 * 128,
35
- widening_factor=8,
36
- key_size=128,
37
- num_q_heads=48,
38
- num_kv_heads=8,
39
- num_layers=64,
40
- attn_output_multiplier=0.08838834764831845,
41
- shard_activations=True,
42
- # MoE.
43
- num_experts=8,
44
- num_selected_experts=2,
45
- # Activation sharding.
46
- data_axis="data",
47
- model_axis="model",
48
- ),
49
- )
50
- inference_runner = InferenceRunner(
51
- pad_sizes=(1024,),
52
- runner=ModelRunner(
53
- model=grok_1_model,
54
- bs_per_device=0.125,
55
- checkpoint_path=CKPT_PATH,
56
- ),
57
- name="local",
58
- load=CKPT_PATH,
59
- tokenizer_path="./tokenizer.model",
60
- local_mesh_config=(1, 8),
61
- between_hosts_config=(1, 1),
62
- )
63
- inference_runner.initialize()
64
- gen = inference_runner.run()
65
-
66
- inp = "The answer to life the universe and everything is of course"
67
- print(f"Output for prompt: {inp}", sample_from_model(gen, inp, max_len=100, temperature=0.01))
68
-
69
-
70
- if __name__ == "__main__":
71
- logging.basicConfig(level=logging.INFO)
72
- main()