[bug] Unable to freeze specific layers of a pretrained model
@jlamypoirier ya está trabajando en esto.
Desde el 25/11/2025.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
🐞 Describe the Bug
I'm trying to freeze specific layers of a pretrained model (for example only layer 0).
The problem is that loading a pretrained model like Apriel-Thinker will load its decoder config as a FixedBlockSequenceConfig. However I need to pass a block-pattern config to freeze only certain layers. e.g.
decoder:
type: pattern
pattern:
- train_block
- freeze_block
- freeze_block
blocks:
train_block:
mlp:
lr_scale: 1.e-12
freeze_block:
lr_scale: 1.e-12
We currently cannot reconcile these two configs.
So the solution would be to prevent loading the pretrained config with load_config: none, and re-pass the entire block config.
However this does not work currently because some type parameters are creeping into the decoder config:
'!!! block':
type: decoder
mixer:
type: attention
rotary:
type: none
mlp:
type: mlp
normalization:
type: layer_norm
🔄 Steps to Reproduce
Steps to reproduce the behavior:
- Fast-LLM version: https://github.com/ServiceNow/Fast-LLM/tree/b7c0de61662c61e83c617bd8157d0bf9426e3d52
- Train with the following config
pretrained:
format: mistral
path: /mnt/checkpoints/upstream/Apriel-Nemotron-15b-Thinker-reinit-attn-layer-0
load_config: none
model:
base_model:
decoder:
type: pattern
pattern:
- train_block
- freeze_block
- freeze_block
- freeze_block
blocks:
train_block:
mlp:
lr_scale: 1.e-12
freeze_block:
lr_scale: 1.e-12
type: gpt
- Fails during config validation with
fast_llm.config.NestedValidationError: Validation failed for field `model` of type `fast_llm.models.gpt.config.GPTModelConfig` in class fast_llm.models.gpt.config.GPTTrainerConfig:
Validation failed for field `base_model` of type `fast_llm.models.gpt.config.GPTBaseModelConfig` in class fast_llm.models.gpt.config.GPTModelConfig:
Validation failed for field `decoder` of type `fast_llm.layers.block.config.BlockSequenceConfig` in class fast_llm.models.gpt.config.GPTBaseModelConfig:
Unknown field `block` in class fast_llm.layers.block.config.PatternBlockSequenceConfig
The decoder config would look like:
decoder:
type: pattern
blocks:
train_block:
[...]
freeze_block:
[...]
pattern:
- train_block
- freeze_block
- freeze_block
- freeze_block
num_blocks: 50
'!!! block': <--- undesired entry coming from the pretrained checkpoint
type: decoder
mixer:
type: attention
rotary:
type: none
mlp:
type: mlp
normalization:
type: layer_norm
🎯 Expected Behavior
Should only load current config
- Lenguaje dominante
- Python
- Estrellas
- 337
- Forks
- 52
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ServiceNow/Fast-LLM
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
ServiceNow/Fast-LLM#556 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
ServiceNow/Fast-LLM#538 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
ServiceNow/Fast-LLM#533 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
ServiceNow/Fast-LLM#510 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
ServiceNow/Fast-LLM#507 ·
Todos los issues de ServiceNow/Fast-LLM
Issues similares
-
changelog investigate
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
ramnes/notion-sdk-py#433 ·
-
docs pkg:core
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
pydantic/pydantic-ai#11929 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
intake/intake-esm#789 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
MemMachine/MemMachine#1877 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openedx/openedx-authz#579 ·
Los mantenedores suelen responder en 1 día