This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import torch | |
| import random | |
| import numpy as np | |
| import pandas as pd | |
| def set_seed(seed: int): | |
| """ | |
| Set random seed for reproducibility across numpy, torch, and python. | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # change directory to /home/ubuntu | |
| cd ~/ | |
| # Function to install Miniconda and create a new conda environment | |
| install_miniconda() { | |
| CONDAENV=$1 | |
| echo "Checking and installing Miniconda..." | |
| mkdir -p ~/miniconda3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Checking and installing Docker..." | |
| if ! command -v docker &> /dev/null; then | |
| echo "Docker is not installed. Installing Docker..." | |
| sudo apt-get install docker -y | |
| sudo service docker start | |
| sudo usermod -aG docker $(whoami) | |
| # newgrp docker removed to prevent script interruption | |
| else | |
| echo "Docker is already installed." | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Installing AWS CLI v2..." | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip awscliv2.zip | |
| sudo ./aws/install | |
| rm awscliv2.zip | |
| rm -rf aws | |
| echo "AWS CLI v2 installed successfully." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Installing Terraform..." | |
| sudo apt-get update && sudo apt-get install -y gnupg software-properties-common | |
| wget -O- https://apt.releases.hashicorp.com/gpg | \ | |
| gpg --dearmor | \ | |
| sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null | |
| gpg --no-default-keyring \ | |
| --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \ | |
| --fingerprint | |
| echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" | |
| echo "$(cat kubectl.sha256) kubectl" | sha256sum --check | |
| sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
| kubectl version --client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir -p ~/miniconda3 | |
| wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh | |
| bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 | |
| rm ~/miniconda3/miniconda.sh | |
| source ~/miniconda3/bin/activate | |
| conda init --all | |
| conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # source: https://github.com/github/gitignore/blob/main/Python.gitignore | |
| # Byte-compiled / optimized / DLL files | |
| __pycache__/ | |
| *.py[cod] | |
| *$py.class | |
| # C extensions | |
| *.so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| from pytz import timezone | |
| from datetime import datetime | |
| def timetz(*args): | |
| tz = timezone("Asia/Kolkata") | |
| return datetime.now(tz).timetuple() | |
| logging.Formatter.converter = timetz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### model | |
| model_id = "mistral-community/Codestral-22B-v0.1" | |
| ### qlora related | |
| r = 64 | |
| lora_alpha = 16 | |
| lora_dropout = 0.1 | |
| target_modules = [ "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"] | |
| task_type = "CAUSAL_LM" |
NewerOlder