This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| ckpt_dir = "/content/ckpt" | |
| ! mkdir -p {ckpt_dir} | |
| ! wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.pt -P {ckpt_dir} | |
| params = """ | |
| {"dim": 768, "multiple_of": 32, "n_heads": 12, "n_layers": 12, "norm_eps": 1e-05, "vocab_size": 32000} | |
| """ | |
| with open(ckpt_dir + "/stories110M_params.json", "w") as f: | |
| f.write(params) | |
| model_path = f"{ckpt_dir}/stories110M.pt" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Archive: /Users/larryliu/Downloads/pytorch_executorch__3.10_cpu_.zip | |
| inflating: /tmp/test-wheel-install-DNylqHi8yw/unzip/executorch-0.2.0.dev0+unknown-cp310-cp310-macosx_11_0_arm64.whl | |
| Remove all packages in environment /Users/larryliu/miniconda3/envs/executorch-tmp: | |
| ## Package Plan ## | |
| environment location: /Users/larryliu/miniconda3/envs/executorch-tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (executorch) [larryliu@devvm1521.ncg0 /data/users/larryliu/executorch (torch_cond_attention)]$ python test.py | |
| ExportedProgram: | |
| class GraphModule(torch.nn.Module): | |
| def forward(self, x: "f32[s0, 3]", y: "f32[s1, 3]", z: "i64[]"): | |
| # | |
| sym_size_int_2: "Sym(s0)" = torch.ops.aten.sym_size.int(x, 0) | |
| sym_size_int_3: "Sym(s1)" = torch.ops.aten.sym_size.int(y, 0); y = None | |
| # File: /data/users/larryliu/executorch/test.py:9 in forward, code: b = z.item() | |
| item: "Sym(u0)" = torch.ops.aten.item.default(z) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <torch/csrc/inductor/aoti_runtime/interface.h> | |
| #include <torch/csrc/inductor/aoti_runtime/model.h> | |
| // Definition of AOTI runtime interface functions | |
| #include <torch/csrc/inductor/aoti_runtime/interface.h> | |
| #include <torch/csrc/inductor/aoti_runtime/model_container.h> | |
| #include <iostream> |