Skip to content

Instantly share code, notes, and snippets.

View XinyueZ's full-sized avatar
🙊
Make sense, don't touch

ChrisDEV XinyueZ

🙊
Make sense, don't touch
View GitHub Profile
@XinyueZ
XinyueZ / i-ask.sh
Last active July 14, 2023 07:30
i-ask.sh, a bash to use openAI api
#!/bin/bash
if [ "$(uname)" == "Darwin" ]; then
# This is a Mac, so use Homebrew
echo "Installing jq with Homebrew..."
brew install jq
else
# Assume this is a Linux system and use apt-get
echo "Installing jq with apt-get..."
sudo apt-get update
@XinyueZ
XinyueZ / gist:db12dfead16476a63c075121d9c3aa4a
Created July 3, 2023 21:41
ubuntu, set launcher to center, similar to MacOS
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false
gsettings set org.gnome.shell.extensions.dash-to-dock dock-position BOTTOM
gsettings set org.gnome.shell.extensions.dash-to-dock transparency-mode FIXED
gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 64
gsettings set org.gnome.shell.extensions.dash-to-dock unity-backlit-items true
@XinyueZ
XinyueZ / pixel_rnn_dataset_logic.py
Created November 12, 2022 00:08
PixelRNNs, dataset logic
def pad_nulls(arraylike, seq_len, input_size):
'''
Pad nulls to the end of the arraylike, so that the length of the arraylike
is divisible by the batch_size.
'''
if len(arraylike)==0:
arraylike = np.zeros( (seq_len, input_size), dtype=np.float32)
remainder = len(arraylike) % seq_len
if remainder != 0:
@XinyueZ
XinyueZ / seq2seq_keras.py
Last active November 11, 2022 23:02
PixelRNNs Many-To-Many
initializer=keras.initializers.he_uniform
#@title Encoder
def create_encoder(input_shape):
inputs = keras.layers.Input(shape=input_shape)
x = keras.layers.Conv1D(filters=HIDDEN_SIZE,
kernel_size=4,
strides=1,
input_shape=input_shape,
kernel_initializer=initializer,
@XinyueZ
XinyueZ / seq2vec.py
Created November 7, 2022 20:48
PixelRNNs Many-To-One
class GenModel(nn.Module):
def _init_weights(self, module):
if module.state_dict().get('weight') != None:
if type(module) == nn.BatchNorm1d:
nn.init.zeros_(module.bias)
else:
nn.init.kaiming_uniform_(module.weight)
def __init__(self, input_size, hidden_size, num_layers, bidirectional):
super().__init__()
@XinyueZ
XinyueZ / seq2seq.py
Created November 7, 2022 20:47
PixelRNNs Many-To-Many
class GenModel(nn.Module):
def _init_weights(self, module):
if module.state_dict().get('weight') != None:
if type(module) == nn.BatchNorm1d:
nn.init.zeros_(module.bias)
else:
nn.init.kaiming_uniform_(module.weight)
def __init__(self, input_size, hidden_size, num_layers, bidirectional):
super().__init__()
@XinyueZ
XinyueZ / image-reduction-with-k-means.ipynb
Created August 28, 2022 14:40
Image Reduction with K-Means.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@XinyueZ
XinyueZ / cnn_transfer_learning_paper_scissors_rock-ipynb-completed.ipynb
Created August 22, 2022 11:36
CNN_Transfer_Learning_paper_scissors_rock.ipynb(Completed)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@XinyueZ
XinyueZ / notebook.ipynb
Created August 22, 2022 11:34
notebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@XinyueZ
XinyueZ / laptop_price_prediction.ipynb
Created July 29, 2022 09:39
laptop_price_prediction.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.