Skip to content

ch06 - fine-tuning an LLM for binary classification task - add vs update output layer #192

Answered by rasbt
kevalshah90 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there,

yes, you are right, there shouldn't be a second lm_head. My guess is that's because the base model has a weird implementation where they have 2 nested models.

Instead of

peft_model.base_model.lm_head = torch.nn.Linear(

you probably need to do

peft_model.base_model.model.lm_head = torch.nn.Linear(...)

Replies: 2 comments 29 replies

Comment options

You must be logged in to vote
15 replies
@rasbt
Comment options

rasbt Jun 8, 2024
Maintainer

@kevalshah90
Comment options

@rasbt
Comment options

@kevalshah90
Comment options

@rasbt
Comment options

Answer selected by rasbt
Comment options

You must be logged in to vote
14 replies
@kevalshah90
Comment options

@rasbt
Comment options

@kevalshah90
Comment options

@rasbt
Comment options

@kevalshah90
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #191 on June 02, 2024 22:27.