Skip to content

Instantly share code, notes, and snippets.

diff --git a/examples/pytorch/language-modeling/run_clm.py b/examples/pytorch/language-modeling/run_clm.py
old mode 100755
new mode 100644
index ca992c045..4472d3e80
--- a/examples/pytorch/language-modeling/run_clm.py
+++ b/examples/pytorch/language-modeling/run_clm.py
@@ -15,12 +15,12 @@
# limitations under the License.
"""
Fine-tuning the library models for causal language modeling (GPT, GPT-2, CTRL, ...) on a text file or a dataset.
import argparse
import csv
import functools
import gc
import io
import itertools
import logging
import numpy as np
import os
import re
@JackCaoG
JackCaoG / resnet50_fwd_dynamo_fx
Created April 22, 2024 19:39
resnet50 fwd dynamo fx
def forward(self, primals_164, primals_321, primals_1, primals_314, primals_230, primals_317, primals_233, primals_320, primals_236, primals_239, primals_160, primals_242, primals_245, primals_248, primals_251, primals_167, primals_254, primals_170, primals_257, primals_173, primals_260, primals_176, primals_263, primals_179, primals_266, primals_182, primals_269, primals_185, primals_272, primals_188, primals_275, primals_191, primals_278, primals_194, primals_281, primals_197, primals_284, primals_200, primals_287, primals_203, primals_290, primals_206, primals_209, primals_293, primals_212, primals_296, primals_215, primals_299, primals_302, primals_218, primals_227, primals_305, primals_221, primals_308, primals_224, primals_311, primals_2, primals_3, primals_162, primals_163, primals_4, primals_13, primals_5, primals_6, primals_165, primals_166, primals_14, primals_15, primals_174, primals_175, primals_7, primals_8, primals_9, primals_168, primals_169, primals_10, primals_11, primals_12, primals_171, pri
IR {
%0 = s64[] prim::Constant(), xla_shape=s64[]
%1 = s64[] prim::Constant(), xla_shape=s64[]
%2 = s64[] xla::device_data(), xla_shape=s64[]
%3 = s64[] aten::add(%2, %1, %0), xla_shape=s64[], ROOT=0
%4 = f32[64,3,7,7]{0,3,2,1} xla::device_data(), xla_shape=f32[64,3,7,7]{0,3,2,1}
%5 = f32[128,3,224,224]{3,2,1,0} xla::device_data(), xla_shape=f32[128,3,224,224]{3,2,1,0}
%6 = f32[128,64,112,112]{3,2,1,0} aten::convolution_overrideable(%5, %4), xla_shape=f32[128,64,112,112]{3,2,1,0}, ROOT=1
%7 = s64[] prim::Constant(), xla_shape=s64[]
%8 = s64[] prim::Constant(), xla_shape=s64[]
def forward(self, relu_25, relu_24, relu_23, relu_22, relu_21, relu_20, relu_19, relu_18, relu_17, relu_16, relu_15, relu_14, relu_13, relu_12, relu_11, relu_10, relu_9, relu_8, relu_7, relu_6, _log_softmax, relu_5, relu_45, relu_4, relu_44, relu_3, relu_43, relu_42, relu_2, relu_1, relu_41, relu, relu_40, relu_39, relu_38, relu_37, relu_36, relu_35, relu_34, relu_33, relu_32, relu_31, relu_30, tangents_1, primals_322, getitem_266, t, relu_29, relu_28, relu_48, relu_27, relu_47, relu_26, relu_46, tangents_2, view, convolution_52, primals_158, getitem_263, getitem_264, getitem_261, getitem_262, primals_157, convolution_51, primals_155, getitem_258, getitem_259, getitem_256, getitem_257, primals_154, convolution_50, primals_152, getitem_253, getitem_254, getitem_251, getitem_252, primals_151, convolution_49, primals_149, getitem_248, getitem_249, getitem_246, getitem_247, primals_148, convolution_48, primals_146, getitem_243, getitem_244, getitem_241, getitem_242, primals_145, convolution_47, primals_143, getit
IR {
%0 = f32[] prim::Constant(), xla_shape=f32[]
%1 = f32[128,1000]{1,0} xla::device_data(), xla_shape=f32[128,1000]{1,0}
%2 = s64[128]{0} xla::device_data(), xla_shape=s64[128]{0}
%3 = f32[] xla::device_data(), xla_shape=f32[]
%4 = f32[128,1000]{1,0} aten::nll_loss_backward(%3, %1, %2), xla_shape=f32[128,1000]{1,0}
%5 = f32[128,1000]{1,0} aten::_log_softmax_backward_data(%4, %1), xla_shape=f32[128,1000]{1,0}
%6 = f32[128,1000]{1,0} xla::device_data(), xla_shape=f32[128,1000]{1,0}
%7 = f32[128,1000]{1,0} aten::add(%6, %5, %0), xla_shape=f32[128,1000]{1,0}
%8 = f32[1,1000]{1,0} aten::sum(%7), xla_shape=f32[1,1000]{1,0}
HloModule IrToHlo.2246, entry_computation_layout={(s64[], s64[], f32[64,3,7,7]{0,3,2,1}, f32[128,3,224,224]{3,2,1,0}, s64[], /*index=5*/s64[], s64[], s64[], s64[], f32[1000,2048]{1,0}, /*index=10*/s64[], s64[], s64[], s64[], s64[], /*index=15*/s64[], s64[], s64[], s64[], s64[], /*index=20*/s64[], s64[], s64[], s64[], s64[], /*index=25*/s64[], s64[], s64[], s64[], s64[], /*index=30*/s64[], s64[], s64[], s64[], s64[], /*index=35*/s64[], s64[], s64[], s64[], s64[], /*index=40*/s64[], s64[], s64[], s64[], s64[], /*index=45*/s64[], s64[], s64[], s64[], s64[], /*index=50*/s64[], s64[], s64[], s64[], s64[], /*index=55*/s64[], f32[64]{0}, f32[64]{0}, f32[64]{0}, f32[64]{0}, /*index=60*/f32[64,64,1,1]{1,0,3,2}, f32[256,64,1,1]{0,1,3,2}, f32[64]{0}, f32[64]{0}, f32[64]{0}, /*index=65*/f32[64]{0}, f32[256]{0}, f32[256]{0}, f32[256]{0}, f32[256]{0}, /*index=70*/f32[64,64,3,3]{1,0,3,2}, f32[64]{0}, f32[64]{0}, f32[64]{0}, f32[64]{0}, /*index=75*/f32[256,64,1,1]{0,1,3,2}, f32[256]{0}, f32[256]{0}, f32[256]{0}, f32[256]{0},
HloModule IrToHlo.1929, entry_computation_layout={(f32[128,1000]{1,0}, s64[128]{0}, f32[], f32[128,1000]{1,0}, f32[128,2048]{1,0}, /*index=5*/f32[2048]{0}, f32[2048]{0}, f32[2048]{0}, f32[128,2048,7,7]{1,0,3,2}, f32[128,2048,7,7]{1,0,3,2}, /*index=10*/f32[], f32[2048,1000]{1,0}, f32[2048,512,1,1]{0,1,3,2}, f32[128,512,7,7]{1,0,3,2}, f32[512]{0}, /*index=15*/f32[512]{0}, f32[512]{0}, f32[128,512,7,7]{1,0,3,2}, f32[512,512,3,3]{1,0,3,2}, f32[128,512,7,7]{1,0,3,2}, /*index=20*/f32[512]{0}, f32[512]{0}, f32[512]{0}, f32[128,512,7,7]{1,0,3,2}, f32[512,2048,1,1]{1,0,3,2}, /*index=25*/f32[128,2048,7,7]{1,0,3,2}, f32[2048]{0}, f32[2048]{0}, f32[2048]{0}, f32[128,2048,7,7]{1,0,3,2}, /*index=30*/f32[2048,512,1,1]{0,1,3,2}, f32[128,512,7,7]{1,0,3,2}, f32[512]{0}, f32[512]{0}, f32[512]{0}, /*index=35*/f32[128,512,7,7]{1,0,3,2}, f32[512,512,3,3]{1,0,3,2}, f32[128,512,7,7]{1,0,3,2}, f32[512]{0}, f32[512]{0}, /*index=40*/f32[512]{0}, f32[128,512,7,7]{1,0,3,2}, f32[512,2048,1,1]{1,0,3,2}, f32[128,2048,7,7]{1,0,3,2}, f32[2048
#0 torch::jit::debug_fn1234_123 () at /workspaces/dk2/pytorch/torch/csrc/jit/python/pybind_utils.h:743
#1 0x00007ffff5de4ca2 in torch::jit::guardAgainstNamedTensor<at::Tensor> (var=...) at /workspaces/dk2/pytorch/torch/csrc/jit/python/pybind_utils.h:749
#2 0x00007ffff5dd0acf in torch::jit::toIValue (obj=..., type=..., N=std::optional<int> [no contained value]) at /workspaces/dk2/pytorch/torch/csrc/jit/python/pybind_utils.cpp:68
#3 0x00007ffff5ddf8cd in torch::jit::argumentToIValue (schema=..., argumentPosition=0, object=...) at /workspaces/dk2/pytorch/torch/csrc/jit/python/pybind_utils.h:805
#4 0x00007ffff5de149c in torch::jit::createStackForSchema (schema=..., args=..., kwargs=..., self=std::optional<c10::IValue> [no contained value]) at /workspaces/dk2/pytorch/torch/csrc/jit/python/pybind_utils.h:1033
#5 0x00007ffff5dd817f in torch::jit::getOpWithStack (operations=std::vector of length 1, capacity 1 = {...}, args=..., kwargs=...) at /workspaces/dk2/pytorch/torch/csrc/jit/python/pybind_utils.cpp:758
#6
HloModule SyncTensorsGraph.4815, buffer_donor={ (0, {}), (1, {}), (2, {}), (3, {}), (4, {}), (6, {}), (7, {}), (8, {}), (9, {}), (10, {}), (11, {}), (12, {}), (13, {}), (14, {}), (15, {}), (16, {}), (17, {}), (18, {}), (19, {}), (20, {}), (21, {}), (22, {}), (23, {}), (24, {}), (25, {}), (26, {}), (27, {}), (28, {}), (29, {}), (30, {}), (31, {}), (32, {}), (33, {}), (34, {}), (35, {}), (36, {}), (37, {}), (38, {}), (39, {}), (40, {}), (41, {}), (42, {}), (43, {}), (44, {}), (45, {}), (46, {}), (47, {}), (48, {}), (49, {}), (50, {}), (51, {}), (52, {}), (53, {}), (54, {}), (55, {}), (56, {}), (57, {}), (58, {}), (59, {}), (60, {}), (61, {}), (62, {}), (63, {}), (64, {}), (65, {}), (66, {}), (67, {}), (68, {}), (69, {}), (70, {}), (71, {}), (72, {}), (73, {}), (74, {}), (75, {}), (76, {}), (77, {}), (78, {}), (79, {}), (80, {}), (81, {}), (82, {}), (83, {}), (84, {}), (85, {}), (86, {}), (87, {}), (88, {}), (89, {}), (90, {}), (91, {}), (92, {}), (93, {}), (94, {}), (95, {}), (96, {}), (97, {}), (98, {}), (99,