Co-authored-by: Yi Xu <xuyi@me.com>
This commit is contained in:
parent
ccdbe87639
commit
fdc2622686
|
@ -361,7 +361,7 @@ pub struct ModelForCausalLM {
|
|||
impl ModelForCausalLM {
|
||||
pub fn new(cfg: &Config, vb: VarBuilder) -> Result<Self> {
|
||||
let base_model = Model::new(cfg, vb.clone())?;
|
||||
let lm_head = if vb.contains_tensor("lm_head") {
|
||||
let lm_head = if vb.contains_tensor("lm_head.weight") {
|
||||
linear_no_bias(cfg.hidden_size, cfg.vocab_size, vb.pp("lm_head"))?
|
||||
} else {
|
||||
Linear::from_weights(base_model.embed_tokens.embeddings().clone(), None)
|
||||
|
|
Loading…
Reference in New Issue