returnn.frontend.conversions.hf_llama

Import the parameters from the HuggingFace Llama model (PyTorch).

returnn.frontend.conversions.hf_llama.import_params_hf_llama_to_rf_transformer_decoder(model_hf: LlamaModel | LlamaForCausalLM, model_rf: TransformerDecoder)[source]

Import params from HF Llama model to RF TransformerDecoder.

returnn.frontend.conversions.hf_llama.import_params_hf_llama_decoder_layer_to_rf(model_hf: LlamaDecoderLayer, model_rf: TransformerDecoderLayer)[source]

Import the parameters from the HF Llama decoder layer.

returnn.frontend.conversions.hf_llama.import_params_hf_llama_mlp_to_rf_feed_forward_gated(model_hf: LlamaMLP, model_rf: FeedForwardGated)[source]

Import the parameters from the HF Llama MLP module.

returnn.frontend.conversions.hf_llama.import_params_hf_llama_rms_norm_to_rf(model_hf: LlamaRMSNorm, model_rf: rf.RMSNorm)[source]

Import the parameters from the HF Llama RMSNorm module.

returnn.frontend.conversions.hf_llama.import_params_hf_llama_att_to_rf_rotary_att(model_hf: LlamaAttention, model_rf: rf.RotaryPosCausalSelfAttention)[source]

Import the parameters from the HF Llama attention module.