Skip to content

Instantly share code, notes, and snippets.

View basic_stanford_sentiment_treebank.jsonnet
// Configuration for a basic LSTM sentiment analysis classifier, using the binary Stanford Sentiment
// Treebank (Socher at al. 2013).
"dataset_reader": {
"type": "sst_tokens",
"use_subtrees": true,
"granularity": "2-class",
"tokenizer": {
"type": "spacy"
View allennlp_mismatched_token_indexer_and_embedder.txt
"dataset_reader": {
"type": "sst_tokens",
"token_indexers": {
"tokens": {
"type": "pretrained_transformer",
"model_name": "bert-base-uncased",
"namespace": "tokens"
xinzhel /
Last active October 31, 2021 08:55
learning-resource-for-machine learning and natural language processing
xinzhel / windows
Last active October 31, 2021 08:59
Windows Setup
View windows
xinzhel /
Last active November 14, 2021 23:13
convert Reuters dataset on kaggle to json file
import logging
import os
import sys
import json
from typing import Dict, Optional
from import tqdm
import timeit
import numpy as np
test = []
train = []
sudo apt update && upgrade
# install pip, ipython3
sudo apt install python3-pip
# 1. load pyenv
curl -L | bash
# Script to create Azure DSVM Spot instance with NVidia P100 GPU
read -p "Azure VM Name (default: dsvm): " vminput
while [ $password != $password2 ] ; do
read -s -p "Choose your Password: " password
read -s -p "Re-enter Password: " password2
xinzhel /
Created May 29, 2022 00:53
Finding an Available Port
import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
 sock.bind(("", 0)
 primary_port = sock.getsockname()[1]
xinzhel / linux
Last active May 30, 2022 08:04
Linux environment setup on Windows (WSL 2)
View linux
  1. Install WSL 2 (with separate linux kernel) and Linux distribution
# run the following command in PowerShell
$ wsl --install -d Ubuntu-18.04

# Ubuntu-18.04 is my preferred Linux distribution. You can find all the supported distributions by running
# wsl --list --online
  • Caveat: you may not launch wsl or Ubuntu without restarting my PC to launch the Ubuntu
xinzhel /
Last active November 18, 2022 06:06
All you need for NLP Publications (Focusing on Conferences; Keep Updating...)