Skip to content

Instantly share code, notes, and snippets.

@j314erre
j314erre / text_cnn.py
Created Jul 13, 2016
load pre-trained word2vec into cnn-text-classification-tf
View text_cnn.py
import tensorflow as tf
import numpy as np
class TextCNN(object):
"""
A CNN for text classification.
Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer.
"""
def __init__(
@j314erre
j314erre / pom.xml
Created Nov 24, 2015
worked for 0.4-rc3.5 but not 0.4-rc3.7
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
@j314erre
j314erre / gist:e151f5955c211fb37d54
Created Nov 24, 2015
java.lang.IllegalStateException: Unable to find path /tmp/nd4j-kernels/output/std_strided.cubin. Recompiling
View gist:e151f5955c211fb37d54
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.nd4j.linalg.jcublas.ops.executioner.JCudaExecutioner.<init>(JCudaExecutioner.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:383)
at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:4551)
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:4499)
at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:140)