Skip to content

Instantly share code, notes, and snippets.

Abay Bektursun abaybektursun

Block or report user

Report or block abaybektursun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@abaybektursun
abaybektursun / logic.java
Last active Mar 10, 2018
Correction for Caleb
View logic.java
if (object.edible == true){
dog.eat(object);
}
else{
dog.tearToShreds(object);
}
@abaybektursun
abaybektursun / setup_lm_1b.sh
Created Mar 23, 2018
Download and setup pre-trained lm_1b model files
View setup_lm_1b.sh
#!/bin/bash
# Assume you are in my_project directory
newdir="language_model"
if [ ! -d "$newdir" ]; then
mkdir "$newdir"
fi
cd "$newdir"
@abaybektursun
abaybektursun / blog_lm1b_1.py
Created Mar 24, 2018
Import and some libraries and declare graph loader function
View blog_lm1b_1.py
import os
import sys
import numpy as np
import tensorflow as tf
# From lm_1b
import language_model.lm_1b.data_utils as data_utils
from six.moves import xrange
from google.protobuf import text_format
@abaybektursun
abaybektursun / blog_lm1b_2.py
Created Mar 24, 2018
Initialize needed variables
View blog_lm1b_2.py
# For saving demo resources, use batch size 1 and step 1.
BATCH_SIZE = 1
NUM_TIMESTEPS = 1
MAX_WORD_LEN = 50
# File Paths
vocab_file = "language_model/data/vocab-2016-09-10.txt"
save_dir = "language_model/output"
pbtxt = "language_model/data/graph-2016-09-10.pbtxt"
ckpt = "language_model/data/ckpt-*"
@abaybektursun
abaybektursun / blog_lm1b_3.py
Last active Mar 24, 2018
Word sequence embeddings
View blog_lm1b_3.py
def forward(sentence):
# Tokenize characters and words
word_ids = [vocab.word_to_id(w) for w in sentence.split()]
char_ids = [vocab.word_to_char_ids(w) for w in sentence.split()]
if sentence.find('<S>') != 0:
sentence = '<S> ' + sentence
for i in xrange(len(word_ids)):
inputs[0, 0] = word_ids[i]
View blog_tensorflow_variable_sequence_classification.py
# Updated to work with TF 1.4
# Working example for my blog post at:
# http://danijar.com/variable-sequence-lengths-in-tensorflow/
import functools
import sets
import tensorflow as tf
from tensorflow import nn
def lazy_property(function):
You can’t perform that action at this time.