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
| #Persistent | |
| #SingleInstance Force | |
| ; ---------- 用户配置区 ---------- | |
| targetColor := "0X2B23DE" ; 格式为 0xRRGGBB(注意是 BGR 顺序),感叹号中的红色颜色 | |
| colorVariation := 30 ; 颜色容差(0-255,越大越宽松) | |
| ; 感叹号区域坐标。如果不确定是多少的话,可以任意调整,鼠标会先显示两次。多显示器设置下,游戏必须处于主显示器 | |
| X1 := 1446 ; 左上角 X | |
| Y1 := 590 ; 左上角 Y |
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
| """ | |
| Inference FLOPs calculation | |
| Borrowed from nanotron: https://github.com/huggingface/nanotron/blob/cfcdeae812d4c7210990932ebcce5f672084408d/src/nanotron/models/llama.py#L1100 | |
| """ | |
| def convert_to_human_readable_size(num): | |
| if num / 1e9 > 1: | |
| return f"{num / 1e9:.2f} B" | |
| elif num / 1e6 > 1: | |
| return f"{num / 1e6:.2f} M" |
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 socket | |
| import debugpy # pip install debugpy | |
| import torch.distributed as dist | |
| def remote_breakpoint(host: str = "0.0.0.0", port: int = 5678, rank: int = 0): | |
| """ | |
| If you found any problems, please contact zhutong (tzhu1997@outlook.com) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 time | |
| import torch | |
| import torch.optim as optim | |
| import torch.nn as nn | |
| from tqdm import trange | |
| class SideAdapterFFNProbing(nn.Module): | |
| """ |
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
| """ | |
| Play sound while reading signal is 0 on Raspberry Pi 3 Model B | |
| Installation: | |
| - python -m pip install gpiozero playsound | |
| - sudo apt install python3-gst-1.0 | |
| """ | |
| import time | |
| import logging |
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
| # Find all users whose username and password are the same | |
| # Tested under linux | |
| # NOTICE: ssh to target IP first to receive fingerprint | |
| # Installation: pip install rich paramiko | |
| import sys | |
| from rich.console import Console | |
| from rich.table import Table | |
| from rich.progress import Progress |
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
| # be like: | |
| # (torch) tzhu @ hostname : ~/REx (main) | |
| # $ | |
| bold=`echo -en "\e[1m"`; underline=`echo -en "\e[4m"`; dim=`echo -en "\e[2m"`; strickthrough=`echo -en "\e[9m"`; blink=`echo -en "\e[5m"`; reverse=`echo -en "\e[7m"`; hidden=`echo -en "\e[8m"`; normal=`echo -en "\e[0m"`; black=`echo -en "\e[30m"`; red=`echo -en "\e[31m"`; green=`echo -en "\e[32m"`; orange=`echo -en "\e[33m"`; blue=`echo -en "\e[34m"`; purple=`echo -en "\e[35m"`; aqua=`echo -en "\e[36m"`; gray=`echo -en "\e[37m"`; darkgray=`echo -en "\e[90m"`; lightred=`echo -en "\e[91m"`; lightgreen=`echo -en "\e[92m"`; lightyellow=`echo -en "\e[93m"`; lightblue=`echo -en "\e[94m"`; lightpurple=`echo -en "\e[95m"`; lightaqua=`echo -en "\e[96m"`; white=`echo -en "\e[97m"`; default=`echo -en "\e[39m"`; BLACK=`echo -en "\e[40m"`; RED=`echo -en "\e[41m"`; GREEN=`echo -en "\e[42m"`; ORANGE=`echo -en "\e[43m"`; BLUE=`echo -en "\e[44m"`; PURPLE=`echo -en "\e[45m"`; AQUA=`echo -en "\e[46m"`; GRAY=`echo -en "\e[47m"`; DARKGRAY=`echo -en "\e[100m"`; LIGHTRED=`ec |
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 re | |
| def sent_seg(text, special_seg_indicators=None, lang='zh', | |
| punctuations=None, quotation_seg_mode=True) -> list: | |
| """ | |
| cut texts into sentences (in chinese language). | |
| Args: | |
| text <str>: texts ready to be cut | |
| special_seg_indicators <list>: some special segment indicators and |
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 json | |
| import numpy as np | |
| import matplotlib as mpl | |
| import matplotlib.pyplot as plt | |
| mpl.rcParams['font.sans-serif'] = ['SimHei'] # 指定默认字体 | |
| mpl.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题 | |
| mpl.rcParams['axes.titlesize'] = 20 |
NewerOlder