PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bash RC For swap command For Linuix Ollama Using Massive Models On RPI 5 Easy!

Go down

Bash RC For swap command For  Linuix Ollama Using Massive Models On RPI 5 Easy! Empty Bash RC For swap command For Linuix Ollama Using Massive Models On RPI 5 Easy!

Post by jamied_uk 2nd October 2024, 14:04

Using a big swap file command is key to loading massive models!


Code:
sudo gedit ~/.bashrc




Code:
function swap() {
    # Set the default size to 20 GB
    local default_swap_size=20
    
    # Check if an argument is supplied
    if [ -z "$1" ]; then
        read -p "Enter Swap Size (GB) [default: $default_swap_size]: " sizeofswap
        # If no input is provided, use the default size
        sizeofswap=${sizeofswap:-$default_swap_size}
        echo "Setting New Swap Size To $sizeofswap GB"
    else
        echo "Setting New Swap Size To $1 GB"
        sizeofswap=$1
    fi

    sudo swapoff /swapfile 
    sudo rm /swapfile
    sudo fallocate -l "${sizeofswap}G" /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    echo "New Swap Size Of $sizeofswap GB"
    free -h
}


now save exit and in new terminal type swap
put in 20 or leave for default of 20 GB

now you can put in password if requested! and load your massive model with ease!
As soon as you run the swap command you can run massive models on a rpi with only 8 gb actual ram Very Happy


Code:
ollama run hermes3
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum