LogoLogo
Continuum Knowledge BankContinuum Applications
  • Introduction
  • Creation of Environment
    • Platform Installation
    • Axolotl Dependencies
    • setup.py objectives
      • script analysis
  • Huggingface Hub
  • Download the dataset
    • Types of Dataset Structures
    • Structuring Datasets for Fine-Tuning Large Language Models
    • Downloading Huggingface Datasets
    • Use Git to download dataset
    • Popular Datasets
    • Download cleaned Alpaca dataset
    • Template-free prompt construction
  • Downloading models
    • Phi 2.0 details
    • Downloading Phi 2.0
    • Available Models
  • Configuration for Training
  • Datasets
  • Model Selection - General
  • Phi 2.0
    • Phi 2.0 - Model Configuration
    • Phi 2.0 - Model Quantization
    • Phi 2.0 - Data Loading and Paths
    • Phi 2.0 - Sequence Configuration
    • Phi 2.0 - Lora Configuration
    • Phi 2.0 - Logging
    • Phi 2.0 - Training Configuration
    • Phi 2.0 - Data and Precision
    • Phi 2.0 - Optimisations
    • Phi 2.0 - Extra Hyperparameters
    • Phi 2.0 - All Configurations
    • Phi 2.0 - Preprocessing
    • Phi 2.0 - Training
    • Uploading Models
  • Llama2
    • Llama2 - Model Configuration
    • Llama2 - Model Quantization
    • Llama2 - Data Loading and Paths
    • Llama2 - Sequence Configuration
    • Llama2 - Lora Configuration
    • Llama2 - Logging
    • Llama2 - Training Configuration
    • Llama2 - Data and Precision
    • Llama2 - Optimisations
    • Llama2 - Extra Hyperparameters
    • Llama2- All Configurations
    • Llama2 - Training Configuration
    • Llama2 - Preprocessing
    • Llama2 - Training
  • Llama3
    • Downloading the model
    • Analysis of model files
      • Model Analysis - Configuration Parameters
      • Model Analysis - Safetensors
      • Tokenizer Configuration Files
        • Model Analysis - tokenizer.json
        • Model Analysis - Special Tokens
    • Llama3 - Model Configuration
    • Llama3 - Model Quantization
    • Llama3 - Data Loading and Paths
    • Llama3 - Sequence Configuration
    • Llama3 - Lora Configuration
    • Llama3 - Logging
    • Llama3 - Training Configuration
    • Llama3 - Data and Precision
    • Llama3 - Optimisations
    • Llama3 - Extra Hyperparameters
    • Llama3- All Configurations
    • Llama3 - Preprocessing
    • Llama3 - Training
    • Full Fine Tune
  • Special Tokens
  • Prompt Construction for Fine-Tuning Large Language Models
  • Memory-Efficient Fine-Tuning Techniques for Large Language Models
  • Training Ideas around Hyperparameters
    • Hugging Face documentation on loading PEFT
  • After fine tuning LLama3
  • Merging Model Weights
  • Merge Lora Instructions
  • Axolotl Configuration Files
    • Configuration Options
    • Model Configuration
    • Data Loading and Processing
    • Sequence Configuration
    • Lora Configuration
    • Logging
    • Training Configuration
    • Augmentation Techniques
  • Axolotl Fine-Tuning Tips & Tricks: A Comprehensive Guide
  • Axolotl debugging guide
  • Hugging Face Hub API
  • NCCL
  • Training Phi 1.5 - Youtube
  • JSON (JavaScript Object Notation)
  • General Tips
  • Datasets
Powered by GitBook
LogoLogo

This documentation is for the Axolotl community

On this page
  • File: model.safetensors.index.json
  • Metadata
  • total_size
  • weight_map
  • Why safetensor?

Was this helpful?

  1. Llama3
  2. Analysis of model files

Model Analysis - Safetensors

File: model.safetensors.index.json

This JSON file serves as an index or a map that provides information about the storage and organisation of the model's weights across multiple files.

It helps the deep learning framework locate and load the appropriate weight files when the model is being used for inference or further training.

Now, let's break down the contents of the file and explain each part in more detail:

Metadata

This section contains metadata about the model.

total_size

Specifies the total size of the model weights in bytes. In this case it is approximately 16 GB.

weight_map

This section is the main part of the index file.

It maps each model parameter to the corresponding file where its weights are stored.

  • Each entry in the "weight_map" follows the format: "parameter_name": "file_name".

  • The "parameter_name" represents the name of a specific parameter in the model architecture. For example, "model.embed_tokens.weight" refers to the embedding matrix used to map input tokens to their corresponding vector representations.

  • The "file_name" indicates the name of the file where the weights for that specific parameter are stored. In this case, the weights are distributed across four files named "model-00001-of-00004.safetensors" to "model-00004-of-00004.safetensors".

The "weight_map" section is organised in a hierarchical manner, following the structure of the model architecture.

Let's break it down further:

  • "model.embed_tokens.weight": Refers to the embedding matrix weights.

  • "model.layers.0.input_layernorm.weight" to "model.layers.31.self_attn.v_proj.weight": These entries correspond to the weights of the 32 transformer layers in the model.

    • Each layer has several components, such as "input_layernorm" (input layer normalization), "mlp" (multilayer perceptron), "self_attn" (self-attention mechanism), and "post_attention_layernorm" (post-attention layer normalization).

    • Within each component, there are specific weights. For example, "self_attn.k_proj.weight" refers to the weights of the key projection matrix in the self-attention mechanism.

  • "model.norm.weight": Represents the weights of the final layer normalization applied to the model's output.

Why safetensor?

The safetensors format is used to store the model weights.

It is a file format designed for efficient storage and loading of large tensors, which is particularly useful for deep learning models.

By distributing the weights across multiple files, the model can be loaded more efficiently, especially when dealing with large models like Llama3.

The index file provides a roadmap for the deep learning framework to locate and load the necessary weights for each parameter during model usage.

When you want to use the Llama3 model, the deep learning framework will read this index file, identify the required weight files, load them into memory, and reconstruct the model architecture by assigning the weights to their corresponding parameters.

PreviousModel Analysis - Configuration ParametersNextTokenizer Configuration Files

Last updated 1 year ago

Was this helpful?

Page cover image