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
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "strings" | |
| "github.com/peterh/liner" |
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
| { | |
| "cycles": [ | |
| { | |
| "start_time_min": 0, | |
| "end_time_min": 3, | |
| "temperature_fahrenheit": 70.58999633789062 | |
| }, | |
| { | |
| "start_time_min": 3, | |
| "end_time_min": 6, |
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 math | |
| import torch | |
| from torch.optim.lr_scheduler import _LRScheduler | |
| from dataclasses import dataclass | |
| from typing import List | |
| @dataclass | |
| class SchedulePhase: | |
| """Defines a phase in the learning rate schedule""" | |
| percent: float # Percentage of total steps this phase covers |
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
| 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)})) |
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 | |
| # 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 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 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 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
| 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 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
| 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 |