alexwengg's picture
g2p-model (#2)
29f6753
program(1.0)
[buildInfo = dict<tensor<string, []>, tensor<string, []>>({{"coremlc-component-MIL", "3510.2.1"}, {"coremlc-version", "3500.32.1"}, {"coremltools-component-torch", "2.7.1"}, {"coremltools-source-dialect", "TorchScript"}, {"coremltools-version", "9.0"}})]
{
func main<ios16>(tensor<fp32, [1, ?, ?]> causal_mask, tensor<int32, [1, ?]> decoder_input_ids, tensor<fp32, [1, ?, 128]> encoder_hidden_states, tensor<int32, [1, ?]> position_ids) [FlexibleShapeInformation = tuple<tuple<tensor<string, []>, dict<tensor<string, []>, tensor<int32, [?]>>>, tuple<tensor<string, []>, dict<tensor<string, []>, list<tensor<int32, [2]>, ?>>>>((("DefaultShapes", {{"causal_mask", [1, 1, 1]}, {"decoder_input_ids", [1, 1]}, {"encoder_hidden_states", [1, 1, 128]}, {"position_ids", [1, 1]}}), ("RangeDims", {{"causal_mask", [[1, 1], [1, 64], [1, 64]]}, {"decoder_input_ids", [[1, 1], [1, 64]]}, {"encoder_hidden_states", [[1, 1], [1, 64], [128, 128]]}, {"position_ids", [[1, 1], [1, 64]]}})))] {
tensor<int32, []> var_27_axis_0 = const()[name = tensor<string, []>("op_27_axis_0"), val = tensor<int32, []>(0)];
tensor<int32, []> var_27_batch_dims_0 = const()[name = tensor<string, []>("op_27_batch_dims_0"), val = tensor<int32, []>(0)];
tensor<fp16, [63, 128]> embed_tokens_weight_to_fp16 = const()[name = tensor<string, []>("embed_tokens_weight_to_fp16"), val = tensor<fp16, [63, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(64)))];
tensor<fp16, [1, ?, 128]> var_27_cast_fp16 = gather(axis = var_27_axis_0, batch_dims = var_27_batch_dims_0, indices = decoder_input_ids, x = embed_tokens_weight_to_fp16)[name = tensor<string, []>("op_27_cast_fp16")];
tensor<int32, []> var_33_axis_0 = const()[name = tensor<string, []>("op_33_axis_0"), val = tensor<int32, []>(0)];
tensor<int32, []> var_33_batch_dims_0 = const()[name = tensor<string, []>("op_33_batch_dims_0"), val = tensor<int32, []>(0)];
tensor<fp16, [66, 128]> embed_positions_weight_to_fp16 = const()[name = tensor<string, []>("embed_positions_weight_to_fp16"), val = tensor<fp16, [66, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(16256)))];
tensor<fp16, [1, ?, 128]> var_33_cast_fp16 = gather(axis = var_33_axis_0, batch_dims = var_33_batch_dims_0, indices = position_ids, x = embed_positions_weight_to_fp16)[name = tensor<string, []>("op_33_cast_fp16")];
tensor<fp16, [1, ?, 128]> input_1_cast_fp16 = add(x = var_27_cast_fp16, y = var_33_cast_fp16)[name = tensor<string, []>("input_1_cast_fp16")];
tensor<int32, [1]> input_3_axes_0 = const()[name = tensor<string, []>("input_3_axes_0"), val = tensor<int32, [1]>([-1])];
tensor<fp16, [128]> layernorm_embedding_weight_to_fp16 = const()[name = tensor<string, []>("layernorm_embedding_weight_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(33216)))];
tensor<fp16, [128]> layernorm_embedding_bias_to_fp16 = const()[name = tensor<string, []>("layernorm_embedding_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(33536)))];
tensor<fp16, []> var_37_to_fp16 = const()[name = tensor<string, []>("op_37_to_fp16"), val = tensor<fp16, []>(0x1.5p-17)];
tensor<fp16, [1, ?, 128]> input_3_cast_fp16 = layer_norm(axes = input_3_axes_0, beta = layernorm_embedding_bias_to_fp16, epsilon = var_37_to_fp16, gamma = layernorm_embedding_weight_to_fp16, x = input_1_cast_fp16)[name = tensor<string, []>("input_3_cast_fp16")];
tensor<fp16, [128, 128]> self_attn_q_weight_to_fp16 = const()[name = tensor<string, []>("self_attn_q_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(33856)))];
tensor<fp16, [128]> self_attn_q_bias_to_fp16 = const()[name = tensor<string, []>("self_attn_q_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(66688)))];
tensor<fp16, [1, ?, 128]> linear_0_cast_fp16 = linear(bias = self_attn_q_bias_to_fp16, weight = self_attn_q_weight_to_fp16, x = input_3_cast_fp16)[name = tensor<string, []>("linear_0_cast_fp16")];
tensor<fp16, [128, 128]> self_attn_k_weight_to_fp16 = const()[name = tensor<string, []>("self_attn_k_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(67008)))];
tensor<fp16, [128]> self_attn_k_bias_to_fp16 = const()[name = tensor<string, []>("self_attn_k_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(99840)))];
tensor<fp16, [1, ?, 128]> linear_1_cast_fp16 = linear(bias = self_attn_k_bias_to_fp16, weight = self_attn_k_weight_to_fp16, x = input_3_cast_fp16)[name = tensor<string, []>("linear_1_cast_fp16")];
tensor<fp16, [128, 128]> self_attn_v_weight_to_fp16 = const()[name = tensor<string, []>("self_attn_v_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(100160)))];
tensor<fp16, [128]> self_attn_v_bias_to_fp16 = const()[name = tensor<string, []>("self_attn_v_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(132992)))];
tensor<fp16, [1, ?, 128]> linear_2_cast_fp16 = linear(bias = self_attn_v_bias_to_fp16, weight = self_attn_v_weight_to_fp16, x = input_3_cast_fp16)[name = tensor<string, []>("linear_2_cast_fp16")];
tensor<bool, []> var_55_transpose_x_1 = const()[name = tensor<string, []>("op_55_transpose_x_1"), val = tensor<bool, []>(false)];
tensor<bool, []> var_55_transpose_y_1 = const()[name = tensor<string, []>("op_55_transpose_y_1"), val = tensor<bool, []>(true)];
tensor<fp16, [1, ?, ?]> var_55_cast_fp16 = matmul(transpose_x = var_55_transpose_x_1, transpose_y = var_55_transpose_y_1, x = linear_0_cast_fp16, y = linear_1_cast_fp16)[name = tensor<string, []>("op_55_cast_fp16")];
tensor<fp16, []> var_56_to_fp16 = const()[name = tensor<string, []>("op_56_to_fp16"), val = tensor<fp16, []>(0x1.6ap-4)];
tensor<fp16, [1, ?, ?]> attn_weights_1_cast_fp16 = mul(x = var_55_cast_fp16, y = var_56_to_fp16)[name = tensor<string, []>("attn_weights_1_cast_fp16")];
tensor<string, []> causal_mask_to_fp16_dtype_0 = const()[name = tensor<string, []>("causal_mask_to_fp16_dtype_0"), val = tensor<string, []>("fp16")];
tensor<fp16, [1, ?, ?]> causal_mask_to_fp16 = cast(dtype = causal_mask_to_fp16_dtype_0, x = causal_mask)[name = tensor<string, []>("cast_4")];
tensor<fp16, [1, ?, ?]> attn_weights_3_cast_fp16 = add(x = attn_weights_1_cast_fp16, y = causal_mask_to_fp16)[name = tensor<string, []>("attn_weights_3_cast_fp16")];
tensor<int32, []> var_60 = const()[name = tensor<string, []>("op_60"), val = tensor<int32, []>(-1)];
tensor<fp16, [1, ?, ?]> attn_weights_5_cast_fp16 = softmax(axis = var_60, x = attn_weights_3_cast_fp16)[name = tensor<string, []>("attn_weights_5_cast_fp16")];
tensor<bool, []> input_5_transpose_x_0 = const()[name = tensor<string, []>("input_5_transpose_x_0"), val = tensor<bool, []>(false)];
tensor<bool, []> input_5_transpose_y_0 = const()[name = tensor<string, []>("input_5_transpose_y_0"), val = tensor<bool, []>(false)];
tensor<fp16, [1, ?, 128]> input_5_cast_fp16 = matmul(transpose_x = input_5_transpose_x_0, transpose_y = input_5_transpose_y_0, x = attn_weights_5_cast_fp16, y = linear_2_cast_fp16)[name = tensor<string, []>("input_5_cast_fp16")];
tensor<fp16, [128, 128]> self_attn_out_weight_to_fp16 = const()[name = tensor<string, []>("self_attn_out_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(133312)))];
tensor<fp16, [128]> self_attn_out_bias_to_fp16 = const()[name = tensor<string, []>("self_attn_out_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(166144)))];
tensor<fp16, [1, ?, 128]> linear_3_cast_fp16 = linear(bias = self_attn_out_bias_to_fp16, weight = self_attn_out_weight_to_fp16, x = input_5_cast_fp16)[name = tensor<string, []>("linear_3_cast_fp16")];
tensor<fp16, [1, ?, 128]> input_7_cast_fp16 = add(x = input_3_cast_fp16, y = linear_3_cast_fp16)[name = tensor<string, []>("input_7_cast_fp16")];
tensor<int32, [1]> input_9_axes_0 = const()[name = tensor<string, []>("input_9_axes_0"), val = tensor<int32, [1]>([-1])];
tensor<fp16, [128]> self_attn_norm_weight_to_fp16 = const()[name = tensor<string, []>("self_attn_norm_weight_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(166464)))];
tensor<fp16, [128]> self_attn_norm_bias_to_fp16 = const()[name = tensor<string, []>("self_attn_norm_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(166784)))];
tensor<fp16, []> var_70_to_fp16 = const()[name = tensor<string, []>("op_70_to_fp16"), val = tensor<fp16, []>(0x1.5p-17)];
tensor<fp16, [1, ?, 128]> input_9_cast_fp16 = layer_norm(axes = input_9_axes_0, beta = self_attn_norm_bias_to_fp16, epsilon = var_70_to_fp16, gamma = self_attn_norm_weight_to_fp16, x = input_7_cast_fp16)[name = tensor<string, []>("input_9_cast_fp16")];
tensor<fp16, [128, 128]> cross_attn_q_weight_to_fp16 = const()[name = tensor<string, []>("cross_attn_q_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(167104)))];
tensor<fp16, [128]> cross_attn_q_bias_to_fp16 = const()[name = tensor<string, []>("cross_attn_q_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(199936)))];
tensor<fp16, [1, ?, 128]> linear_4_cast_fp16 = linear(bias = cross_attn_q_bias_to_fp16, weight = cross_attn_q_weight_to_fp16, x = input_9_cast_fp16)[name = tensor<string, []>("linear_4_cast_fp16")];
tensor<string, []> encoder_hidden_states_to_fp16_dtype_0 = const()[name = tensor<string, []>("encoder_hidden_states_to_fp16_dtype_0"), val = tensor<string, []>("fp16")];
tensor<fp16, [128, 128]> cross_attn_k_weight_to_fp16 = const()[name = tensor<string, []>("cross_attn_k_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(200256)))];
tensor<fp16, [128]> cross_attn_k_bias_to_fp16 = const()[name = tensor<string, []>("cross_attn_k_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(233088)))];
tensor<fp16, [1, ?, 128]> encoder_hidden_states_to_fp16 = cast(dtype = encoder_hidden_states_to_fp16_dtype_0, x = encoder_hidden_states)[name = tensor<string, []>("cast_3")];
tensor<fp16, [1, ?, 128]> linear_5_cast_fp16 = linear(bias = cross_attn_k_bias_to_fp16, weight = cross_attn_k_weight_to_fp16, x = encoder_hidden_states_to_fp16)[name = tensor<string, []>("linear_5_cast_fp16")];
tensor<fp16, [128, 128]> cross_attn_v_weight_to_fp16 = const()[name = tensor<string, []>("cross_attn_v_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(233408)))];
tensor<fp16, [128]> cross_attn_v_bias_to_fp16 = const()[name = tensor<string, []>("cross_attn_v_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(266240)))];
tensor<fp16, [1, ?, 128]> linear_6_cast_fp16 = linear(bias = cross_attn_v_bias_to_fp16, weight = cross_attn_v_weight_to_fp16, x = encoder_hidden_states_to_fp16)[name = tensor<string, []>("linear_6_cast_fp16")];
tensor<bool, []> var_88_transpose_x_1 = const()[name = tensor<string, []>("op_88_transpose_x_1"), val = tensor<bool, []>(false)];
tensor<bool, []> var_88_transpose_y_1 = const()[name = tensor<string, []>("op_88_transpose_y_1"), val = tensor<bool, []>(true)];
tensor<fp16, [1, ?, ?]> var_88_cast_fp16 = matmul(transpose_x = var_88_transpose_x_1, transpose_y = var_88_transpose_y_1, x = linear_4_cast_fp16, y = linear_5_cast_fp16)[name = tensor<string, []>("op_88_cast_fp16")];
tensor<fp16, []> var_89_to_fp16 = const()[name = tensor<string, []>("op_89_to_fp16"), val = tensor<fp16, []>(0x1.6ap-4)];
tensor<fp16, [1, ?, ?]> attn_weights_7_cast_fp16 = mul(x = var_88_cast_fp16, y = var_89_to_fp16)[name = tensor<string, []>("attn_weights_7_cast_fp16")];
tensor<int32, []> var_91 = const()[name = tensor<string, []>("op_91"), val = tensor<int32, []>(-1)];
tensor<fp16, [1, ?, ?]> attn_weights_cast_fp16 = softmax(axis = var_91, x = attn_weights_7_cast_fp16)[name = tensor<string, []>("attn_weights_cast_fp16")];
tensor<bool, []> input_11_transpose_x_0 = const()[name = tensor<string, []>("input_11_transpose_x_0"), val = tensor<bool, []>(false)];
tensor<bool, []> input_11_transpose_y_0 = const()[name = tensor<string, []>("input_11_transpose_y_0"), val = tensor<bool, []>(false)];
tensor<fp16, [1, ?, 128]> input_11_cast_fp16 = matmul(transpose_x = input_11_transpose_x_0, transpose_y = input_11_transpose_y_0, x = attn_weights_cast_fp16, y = linear_6_cast_fp16)[name = tensor<string, []>("input_11_cast_fp16")];
tensor<fp16, [128, 128]> cross_attn_out_weight_to_fp16 = const()[name = tensor<string, []>("cross_attn_out_weight_to_fp16"), val = tensor<fp16, [128, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(266560)))];
tensor<fp16, [128]> cross_attn_out_bias_to_fp16 = const()[name = tensor<string, []>("cross_attn_out_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(299392)))];
tensor<fp16, [1, ?, 128]> linear_7_cast_fp16 = linear(bias = cross_attn_out_bias_to_fp16, weight = cross_attn_out_weight_to_fp16, x = input_11_cast_fp16)[name = tensor<string, []>("linear_7_cast_fp16")];
tensor<fp16, [1, ?, 128]> input_13_cast_fp16 = add(x = input_9_cast_fp16, y = linear_7_cast_fp16)[name = tensor<string, []>("input_13_cast_fp16")];
tensor<int32, [1]> input_15_axes_0 = const()[name = tensor<string, []>("input_15_axes_0"), val = tensor<int32, [1]>([-1])];
tensor<fp16, [128]> cross_attn_norm_weight_to_fp16 = const()[name = tensor<string, []>("cross_attn_norm_weight_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(299712)))];
tensor<fp16, [128]> cross_attn_norm_bias_to_fp16 = const()[name = tensor<string, []>("cross_attn_norm_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(300032)))];
tensor<fp16, []> var_101_to_fp16 = const()[name = tensor<string, []>("op_101_to_fp16"), val = tensor<fp16, []>(0x1.5p-17)];
tensor<fp16, [1, ?, 128]> input_15_cast_fp16 = layer_norm(axes = input_15_axes_0, beta = cross_attn_norm_bias_to_fp16, epsilon = var_101_to_fp16, gamma = cross_attn_norm_weight_to_fp16, x = input_13_cast_fp16)[name = tensor<string, []>("input_15_cast_fp16")];
tensor<fp16, [1024, 128]> fc1_weight_to_fp16 = const()[name = tensor<string, []>("fc1_weight_to_fp16"), val = tensor<fp16, [1024, 128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(300352)))];
tensor<fp16, [1024]> fc1_bias_to_fp16 = const()[name = tensor<string, []>("fc1_bias_to_fp16"), val = tensor<fp16, [1024]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(562560)))];
tensor<fp16, [1, ?, 1024]> linear_8_cast_fp16 = linear(bias = fc1_bias_to_fp16, weight = fc1_weight_to_fp16, x = input_15_cast_fp16)[name = tensor<string, []>("linear_8_cast_fp16")];
tensor<string, []> input_17_mode_0 = const()[name = tensor<string, []>("input_17_mode_0"), val = tensor<string, []>("EXACT")];
tensor<fp16, [1, ?, 1024]> input_17_cast_fp16 = gelu(mode = input_17_mode_0, x = linear_8_cast_fp16)[name = tensor<string, []>("input_17_cast_fp16")];
tensor<fp16, [128, 1024]> fc2_weight_to_fp16 = const()[name = tensor<string, []>("fc2_weight_to_fp16"), val = tensor<fp16, [128, 1024]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(564672)))];
tensor<fp16, [128]> fc2_bias_to_fp16 = const()[name = tensor<string, []>("fc2_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(826880)))];
tensor<fp16, [1, ?, 128]> linear_9_cast_fp16 = linear(bias = fc2_bias_to_fp16, weight = fc2_weight_to_fp16, x = input_17_cast_fp16)[name = tensor<string, []>("linear_9_cast_fp16")];
tensor<fp16, [1, ?, 128]> input_19_cast_fp16 = add(x = input_15_cast_fp16, y = linear_9_cast_fp16)[name = tensor<string, []>("input_19_cast_fp16")];
tensor<int32, [1]> input_axes_0 = const()[name = tensor<string, []>("input_axes_0"), val = tensor<int32, [1]>([-1])];
tensor<fp16, [128]> final_layer_norm_weight_to_fp16 = const()[name = tensor<string, []>("final_layer_norm_weight_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(827200)))];
tensor<fp16, [128]> final_layer_norm_bias_to_fp16 = const()[name = tensor<string, []>("final_layer_norm_bias_to_fp16"), val = tensor<fp16, [128]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(827520)))];
tensor<fp16, []> var_118_to_fp16 = const()[name = tensor<string, []>("op_118_to_fp16"), val = tensor<fp16, []>(0x1.5p-17)];
tensor<fp16, [1, ?, 128]> input_cast_fp16 = layer_norm(axes = input_axes_0, beta = final_layer_norm_bias_to_fp16, epsilon = var_118_to_fp16, gamma = final_layer_norm_weight_to_fp16, x = input_19_cast_fp16)[name = tensor<string, []>("input_cast_fp16")];
tensor<fp16, [63]> linear_10_bias_0_to_fp16 = const()[name = tensor<string, []>("linear_10_bias_0_to_fp16"), val = tensor<fp16, [63]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(827840)))];
tensor<fp16, [1, ?, 63]> logits = linear(bias = linear_10_bias_0_to_fp16, weight = embed_tokens_weight_to_fp16, x = input_cast_fp16)[name = tensor<string, []>("linear_10_cast_fp16")];
} -> (logits);
}