Skip to content

Instantly share code, notes, and snippets.

@j314erre
j314erre / text_cnn.py
Created July 13, 2016 00:00
load pre-trained word2vec into cnn-text-classification-tf
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 November 24, 2015 21:32
worked for 0.4-rc3.5 but not 0.4-rc3.7
<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 November 24, 2015 21:01
java.lang.IllegalStateException: Unable to find path /tmp/nd4j-kernels/output/std_strided.cubin. Recompiling
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)