Implementation:Ollama Ollama Llama Model InternLM2
Appearance
| Knowledge Sources | |
|---|---|
| Domains | LLM Inference, Model Architecture |
| Last Updated | 2025-02-15 00:00 GMT |
Overview
Implements the ggml computation graph builder for the InternLM2 model architecture.
Description
The llm_build_internlm2 constructor builds a standard transformer with RoPE-based positional encoding, RMS-normalized self-attention with Q/K/V projections and optional biases, and SiLU-gated feed-forward layers across all transformer blocks. The architecture follows a standard dense transformer pattern with grouped-query attention support.
Usage
Enables Ollama to run InternLM2 family models through the llama.cpp inference engine.
Code Reference
Source Location
- Repository: Ollama
- File:
llama/llama.cpp/src/models/internlm2.cpp - Lines: 1-120
Signature
llm_build_internlm2::llm_build_internlm2(
const llama_model & model,
const llm_graph_params & params) : llm_graph_context(params);
Import
#include "models.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| model | const llama_model & | Yes | Loaded model with InternLM2 weights |
| params | const llm_graph_params & | Yes | Graph construction parameters |
Outputs
| Name | Type | Description |
|---|---|---|
| ggml graph | ggml_cgraph | Complete InternLM2 computation graph |
Usage Examples
auto builder = llm_build_internlm2(model, params);
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment