Skip to content

Instantly share code, notes, and snippets.

View Jeffwan's full-sized avatar

Jiaxin Shan Jeffwan

  • Bytedance
  • Seattle, WA
View GitHub Profile
@Jeffwan
Jeffwan / sharegpt_dataset_clean.csv
Created May 4, 2024 03:20
LLM inference engine benchmark testing
We can't make this file beautiful and searchable because it's too large.
prompt,input_length,output_length
Are you working?,16,1024
"Of course! Here are a few more suggestions for trendy names for your skincare products:
1. Butterfly Pea Cleanser - ""Butterfly Bliss""
2. Hibiscus Serum - ""Hibiscus Elixir""
3. Marigold Sunscreen - ""Marigold Shield""
4. Butterfly Pea Cleanser - ""Petal Perfection""
5. Hibiscus Serum - ""Hibiscus Harmony""
6. Marigold Sunscreen - ""Marigold Marvel""
@Jeffwan
Jeffwan / dcp-metrics-included.csv
Created March 22, 2024 21:29
dcgm metric configuration
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 3. in line 2.
# Format
# If line starts with a '#' it is considered a comment
# DCGM FIELD, Prometheus metric type, help message
# Clocks
DCGM_FI_DEV_SM_CLOCK, gauge, SM clock frequency (in MHz).
DCGM_FI_DEV_MEM_CLOCK, gauge, Memory clock frequency (in MHz).
# Temperature
DCGM_FI_DEV_MEMORY_TEMP, gauge, Memory temperature (in C).
@Jeffwan
Jeffwan / Compression.java
Created February 7, 2014 20:01
Basic String Compression Input: aabbc Output: a2b2c1 CC 150 - Arrays and Strings
package leetcode;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
/**
@Jeffwan
Jeffwan / InPreBuildTree.java
Last active January 14, 2023 10:49
Construct Binary Tree from Preorder and Inorder Traversal @leetcode
package leetcode.tree;
/**
* Solution:
* preorder: 7 10 4 3 1 (left) 2 8 11 (left)
* inorder: 4 10 3 1 (left) 7 11 8 2 (right)
*
* 1. the first node in preorder must be root
* 2. find out root position in inorder, and then root.left will be left part, same as root.right.
* 3. Preorder: root, root.left, root.right --> (preStart+1, prestart+Index-inStart) will be left part, the rest are right part.
package leetcode;
import java.util.Stack;
/**
* Solution: Stack left --> push, right -->pop and compare
* Didn't check if s is valid. like "", a little vague here, need to ask interviewer.
*
* The problem says this string contains just these 6 char but not other! read carefully!
* the last part check is stack.size() > 0. use return stack.isEmpty() to refactor.
@Jeffwan
Jeffwan / guidance.md
Last active June 16, 2022 06:55
workspace-operator example

Setups to try workspace operator

  1. Make sure you have ray-system namespace. if not, kubectl create ns ray-system
  2. kubectl create -f ray.io_workspaces.yaml
  3. kubectl apply -f workspace-operator.yaml
  4. Create a jupyter notebook. kubectl apply -f ray.io_v1alpha1_workspace.yaml
  5. Use the nodeport or port-forward the service. Then open browser nodeip:nodeport/kuberay/workspace.

Note: operator image and jupyter image can be used directly. I upload to my personal dockerhub. I will try to finish OSS process soon.

@Jeffwan
Jeffwan / override.go
Last active February 20, 2022 17:48
Abstract class and interface in golang
package mxnet
import "fmt"
type ControllerInterface interface {
// Returns the Controller name
Method1() string
// Returns the GroupVersionKind of the API
Method2() string
@Jeffwan
Jeffwan / InPostBuildTree.java
Created February 14, 2014 06:40
Construct Binary Tree from Inorder and Postorder Traversal @leetcode
package leetcode.tree;
/**
* Solution:
* postorder: 4 1 3 10 (left) 11 8 2 (right) 7
* inorder: 4 10 3 1 (left) 7 11 8 2 (right)
*
* Same as Preorder - Inorder Construction. Only difference is sequence and index handling.
*
* @author jeffwan
@Jeffwan
Jeffwan / spark-ray-redis.py
Last active April 11, 2021 05:03
spark-ray-redis.py
import os
import ray
import raydp
HEAD_SERVICE_IP_ENV = "EXAMPLE_CLUSTER_RAY_HEAD_SERVICE_HOST"
head_service_ip = os.environ[HEAD_SERVICE_IP_ENV]
ray.init(address=f"{head_service_ip}:6379")
import argparse
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
import numpy as np
import os
import ray
from ray import tune
from ray.util.sgd.tf.tf_trainer import TFTrainer, TFTrainable