Hello, I’m trying to convert a LLama model from safetonsors to TensorNetwork to reduce weight and speed up inference. I’m trying to integrate tensor layers into an existing model. However, I encounter errors. I want to retain all the knowledge of the model without training it. Has anyone tried this already? maybe there is a laptop of some kind so that we can see the working implementations
ValueError Traceback (most recent call last)
<ipython-input-34-c141f1326ef0> in <cell line: 36>()
34
35 # Применение функций
---> 36 replace_with_tn_layers(model, tn_layers, test_input)
37
38
<ipython-input-34-c141f1326ef0> in replace_with_tn_layers(model, tn_layers, test_input)
19 model._modules[name] = tn_layer
20 if u.shape != tn_layer.kernel1.shape or v.shape != tn_layer.kernel2.shape:
---> 21 raise ValueError(f"Несоответствие размеров для слоя {name}: размер u: {u.shape}, размер kernel1: {tn_layer.kernel1.shape}, размер v: {v.shape}, размер kernel2: {tn_layer.kernel2.shape}")
22 tn_layer.kernel1.assign(tf.convert_to_tensor(u, dtype=tf.float32))
23 tn_layer.kernel2.assign(tf.convert_to_tensor(v, dtype=tf.float32))
ValueError: Несоответствие размеров для слоя layers.0.self_attn.k_proj: размер u: (256, 64), размер kernel1: (2048, 64), размер v: (64, 2048), размер kernel2: (64, 256)