# Llama Models — Official Meta Model Utilities and Definitions > The official Meta repository containing model definitions, tokenizer utilities, and reference implementations for the Llama family of large language models including Llama 2 and Llama 3. ## Install Save as a script file and run: # Llama Models — Official Meta Model Utilities and Definitions ## Quick Use ```bash pip install llama-models ``` ```python from llama_models.llama3.api import Llama3Tokenizer tokenizer = Llama3Tokenizer("/path/to/tokenizer.model") tokens = tokenizer.encode("Hello, world!", bos=True, eos=False) print(tokens) ``` ## Introduction Llama Models is Meta's official repository providing model architecture definitions, tokenizer implementations, and utility code for the Llama family of open-weight language models. It serves as the canonical reference for anyone building on top of Llama 2, Llama 3, or subsequent releases, providing the exact model specifications and supporting code. ## What Llama Models Does - Provides official model architecture definitions for all Llama variants and sizes - Includes tokenizer implementations with the correct vocabulary and special tokens - Defines model configuration parameters (dimensions, layers, heads) for each release - Offers prompt formatting utilities for chat, instruction, and tool-use templates - Documents the safety system prompt and content filtering approach ## Architecture Overview The repository contains Python dataclass definitions for model hyperparameters, a reference transformer implementation, and the SentencePiece/tiktoken-based tokenizer. Llama 3 uses a standard decoder-only transformer with grouped-query attention (GQA), RoPE positional embeddings, SwiGLU activations, and RMSNorm. The configs specify exact dimensions for 8B, 70B, and 405B parameter variants. ## Self-Hosting & Configuration - Install via pip to access model definitions and tokenizer utilities programmatically - Download model weights separately from Meta's official distribution portal after license acceptance - Use the provided configs to initialize models in PyTorch, Hugging Face, or custom frameworks - Reference the chat template formatting for correct multi-turn conversation structure - Integrate the tokenizer with inference servers like vLLM, TGI, or llama.cpp ## Key Features - Canonical source of truth for Llama model specifications and configurations - Chat template definitions ensuring correct prompt formatting across deployments - Support for tool calling and structured output format specifications - Backward-compatible utilities covering Llama 2 through Llama 3 model families - Clear documentation of model capabilities, limitations, and intended use cases ## Comparison with Similar Tools - **Hugging Face Transformers** — provides converted model weights and inference; llama-models is the authoritative source for architecture specs - **llama.cpp** — C++ inference engine; llama-models provides the Python reference implementation - **LitGPT** — training framework supporting Llama; llama-models is Meta's official definition only - **Ollama** — end-user LLM runner; llama-models targets developers building on the architecture - **Llama Stack** — Meta's full application framework; llama-models focuses on model definitions ## FAQ **Q: Do I need this package to use Llama models?** A: Not necessarily. Most users access Llama via Hugging Face or Ollama. This package is for developers who need the canonical model definitions or tokenizer directly. **Q: Where do I get the actual model weights?** A: Download weights from Meta's official portal (llama.meta.com) or from Hugging Face Hub after accepting the license agreement. **Q: What is the license for Llama models?** A: Llama 3 uses the Meta Llama 3 Community License, which allows commercial use with some restrictions for very large deployments. **Q: Does this support fine-tuning?** A: The repository provides model definitions. For fine-tuning, use frameworks like torchtune, Axolotl, or LLaMA-Factory with the architecture from this package. ## Sources - https://github.com/meta-llama/llama-models - https://llama.meta.com --- Source: https://tokrepo.com/en/workflows/asset-bb0362a5 Author: Script Depot