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
from threading import Event, Thread | |
import gradio as gr | |
import torch | |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer, GenerationConfig | |
model_name = "codellama/CodeLlama-7b-Python-hf" |
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
# make video with pictures | |
ffmpeg.exe -framerate 0.375 -i .\photos\%d.png -i .\audio_3886dab2976147ad8046875a45f5b8cc.wav -c:v libx264 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k output-1.mp4 | |
# extract audio from video | |
ffmpeg.exe -i input.mp4 -vn -acodec copy output.aac | |
# audio aac to mp3 | |
ffmpeg.exe -i output1.aac -c:a libmp3lame -ar 16000 -q:a 2 output1.mp3 |
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
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM | |
# Setup the gradio Demo. | |
import gradio as gr | |
tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-zh-en") | |
model = AutoModelForSeq2SeqLM.from_pretrained("Helsinki-NLP/opus-mt-zh-en") | |
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 | |
function show_haproxy_socket_info(){ | |
ret=$(ss -tnlp|grep haproxy) | |
echo $ret | |
pstr=$(echo $ret | awk -F'\t' '{split($NF, a, ","); split(a[2], b, "="); split(a[3], c, "="); split(c[2], d, ")"); print b[2], d[1]}') | |
IFS=' ' | |
read -r -a array <<< "$pstr" |
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 | |
RES=$(find ~/Documents/collections|awk -F'@@@' '{a=a"@@@"$1;} END {print a;}') | |
echo $RES | |
IFS='@@@' read -ra DATA <<< "$RES" |
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
awk '/Eden:/ {split($2, a, ")"); split(a[2], b, "("); print substr(b[2], 1, length(b[2])-1)}' gc.log |
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
# pipe | |
awk '/GC pause/ {split($2, a, ":"); print a[1]}'|awk 'NR % 2 == 1 {t1 = $1}; NR % 2 == 0 {d = $1 - t1; print d; next}' | |
# gc log file | |
awk '/GC pause/ {split($2, a, ":"); print a[1]}' gc.log|awk 'NR % 2 == 1 {t1 = $1}; NR % 2 == 0 {d = $1 - t1; print d; next}' |
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
// min, mean, max, p50, p90, p99, p999 | |
sort -k1 -n|awk '{s[NR]=$1} END {print "min:"s[1], "mean:"s[int(NR * 0.5)], "p90:"s[int(NR * 0.9)], "p95:"s[int(NR * 0.95)], "p99:"s[int(NR * 0.99)], "p999:"s[int(NR * 0.999)], "max:"s[NR]}' |
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
// jni stall | |
awk '/Setting _needs_gc/ || /is performing GC after exiting critical section/ {split($1, a, ":"); if($0 ~ /Setting _needs_gc/) {print "b", a[1];} else {print "e", a[1];}}' gc.log|awk '{if($1 == "b") {t1 = $2; next} if(t1 != 0) {d = $2 - t1; t1 = 0; print d; next}}' | |
// safepoint synchronization stall | |
grep 'GCLocker Initiated GC' -B 1 gc.log |grep -v '\-\-'|grep -v Times|awk 'NR % 2 == 1 {split($1, a, ":"); t1 = a[1]; cs=1; if ($0 ~ /GCLocker Initiated GC/) {cs=0}}; NR % 2 == 0 {split($2, a, ":"); t2 = a[1]; if(cs == 1) {duration = t2 - t1} else {duration = 0}; print duration; next}'|awk '$1 > 0' |
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
awk '/GC pause/ || /Heap:/ {if($0 ~ /GC pause/) {split($2, a, ":"); print a[1];} else {print $NF}}' gc.log|awk 'NR % 4 == 1 {s1 = $0}; NR % 4 == 2 {split($NF, a, "("); split(a[2], b, "->"); h1 = substr(b[2], 1, length(b[2]) -1); if(b[2] ~ /G$/) {h1 = h1 * 1024}}; NR % 4 == 3 {s2 = $0}; NR % 4 == 0 {split($NF, a, "("); h2 = substr(a[1], 1, length(a[1]) -1); if(a[1] ~ /G$/) {h2 = h2 * 1024}; duration = s2 - s1; heap = h2 - h1; print s2, duration, heap / duration; next}' |
NewerOlder