2 writes to Dtype
Microsoft.ML.GenAI.Phi (2)
Phi2\Config.cs (1)
39
this.
Dtype
= ScalarType.Float32;
Phi2\Phi2ForCasualLM.cs (1)
60
modelConfig.
Dtype
= torchDtype;
14 references to Dtype
Microsoft.ML.GenAI.Phi (14)
Module\Phi2Attention.cs (8)
71
this.q_proj = new GenAILinear(this._hiddenSize, this._numAttentionHeads * this._headDim, hasBias: true, dtype: config.
Dtype
);
72
this.k_proj = new GenAILinear(this._hiddenSize, this._numKeyValueHeads * this._headDim, hasBias: true, dtype: config.
Dtype
);
73
this.v_proj = new GenAILinear(this._hiddenSize, this._numKeyValueHeads * this._headDim, hasBias: true, dtype: config.
Dtype
);
74
this.dense = new GenAILinear(this._numAttentionHeads * this._headDim, this._hiddenSize, hasBias: true, dtype: config.
Dtype
);
79
this.q_layernorm = nn.LayerNorm(this._hiddenSize / this._numAttentionHeads, eps: config.LayerNormEps, elementwise_affine: true, dtype: config.
Dtype
);
80
this.k_layernorm = nn.LayerNorm(this._hiddenSize / this._numAttentionHeads, eps: config.LayerNormEps, elementwise_affine: true, dtype: config.
Dtype
);
88
this.cache_k = torch.zeros(maxBatch, this._numKeyValueHeads, maxLength, this._headDim, dtype: config.
Dtype
);
89
this.cache_v = torch.zeros(maxBatch, this._numKeyValueHeads, maxLength, this._headDim, dtype: config.
Dtype
);
Module\Phi2DecoderLayer.cs (1)
38
this.input_layernorm = nn.LayerNorm(config.HiddenSize, eps: config.LayerNormEps, dtype: config.
Dtype
);
Module\Phi2MLP.cs (2)
25
this.fc1 = new GenAILinear(config.HiddenSize, config.IntermediateSize, dtype: config.
Dtype
);
26
this.fc2 = new GenAILinear(config.IntermediateSize, config.HiddenSize, dtype: config.
Dtype
);
Module\Phi2Model.cs (2)
41
this.embed_tokens = nn.Embedding(config.VocabSize, config.HiddenSize, dtype: config.
Dtype
);
43
this.final_layernorm = nn.LayerNorm(config.HiddenSize, eps: config.LayerNormEps, dtype: config.
Dtype
);
Phi2\Phi2ForCasualLM.cs (1)
28
this.lm_head = new GenAILinear(config.HiddenSize, config.VocabSize, dtype: config.
Dtype
);