Skip to content

Instantly share code, notes, and snippets.

View kadaliao's full-sized avatar
:octocat:

Kada Liao kadaliao

:octocat:
  • Beijing
View GitHub Profile
#!/usr/local/bin/bash
############################### FOLDER ICONS ###################################
folder="$(pwd)"
# Construct the path for the folder icon
FOLDER_ICON_PATH="$folder/.icon"
if [ -f $FOLDER_ICON_PATH ]; then
import copy
X = spark.createDataFrame([[1,2], [3,4]], ['a', 'b'])
_schema = copy.deepcopy(X.schema)
_X = X.rdd.zipWithIndex().toDF(_schema)
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except: