mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Quantized version for phi-v2. (#1430)
* Quantized version for phi-v2. * More quantized support.
This commit is contained in:
@ -287,6 +287,24 @@ pub struct MixFormerSequentialForCausalLM {
|
||||
}
|
||||
|
||||
impl MixFormerSequentialForCausalLM {
|
||||
pub fn new_v2(cfg: &Config, vb: VarBuilder) -> Result<Self> {
|
||||
let vb_head = vb.pp("lm_head");
|
||||
let vb = vb.pp("transformer");
|
||||
let embedding = Embedding::new(cfg, vb.pp("embd"))?;
|
||||
let mut blocks = Vec::new();
|
||||
for i in 0..cfg.n_layer {
|
||||
let block = ParallelBlock::new(cfg, vb.pp("h").pp(i))?;
|
||||
blocks.push(block)
|
||||
}
|
||||
let head = CausalLMHead::new(cfg, vb_head)?;
|
||||
Ok(Self {
|
||||
embedding,
|
||||
blocks,
|
||||
head,
|
||||
span: tracing::span!(tracing::Level::TRACE, "mixformer"),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new(cfg: &Config, vb: VarBuilder) -> Result<Self> {
|
||||
let vb = vb.pp("layers");
|
||||
let embedding = Embedding::new(cfg, vb.pp(0))?;
|
||||
|
Reference in New Issue
Block a user