This file contains 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
def soup_two_models(model, second_model): | |
souped_model = copy.deepcopy(model) | |
for param in souped_model.named_parameters(): | |
name = param[0] | |
param[1].data = (model.state_dict()[name] + second_model.state_dict()[name]) / 2 | |
return souped_model |
This file contains 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
def get_GPU_usage(): | |
cmd = "nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits" | |
result = subprocess.check_output(cmd, shell=True).decode('utf-8') | |
usages = list(map(int, result.strip().split('\n'))) | |
return usages |
This file contains 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 sys | |
import subprocess | |
import tempfile | |
import shutil | |
def main(): | |
if len(sys.argv) != 2: | |
print("Usage: python script.py <github_repo_url>") | |
sys.exit(1) |
This file contains 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 | |
# ollama run llama3.2:1b | |
# chmod +x talk.sh | |
# ./talk.sh "Your question here" | |
# Check if a question is passed as an argument | |
if [ -z "$1" ]; then | |
echo "Usage: ./talk.sh 'Your question here'" | |
exit 1 | |
fi |
This file contains 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
function theme_precmd { | |
local TERMWIDTH=$(( COLUMNS - ${ZLE_RPROMPT_INDENT:-1} )) | |
PR_FILLBAR="" | |
PR_PWDLEN="" | |
local promptsize=${#${(%):---(%n@%m:%l)---()--}} | |
local rubypromptsize=${#${(%)$(ruby_prompt_info)}} | |
local pwdsize=${#${(%):-%~}} | |
local venvpromptsize=$((${#$(virtualenv_prompt_info)})) |