Skip to content

Instantly share code, notes, and snippets.

👨‍🔬

Pedro Rodriguez EntilZha

👨‍🔬
Block or report user

Report or block EntilZha

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
@EntilZha
EntilZha / qanta.py
Created Nov 14, 2019
AllenNLP Reader for Qanta Dataset
View qanta.py
from typing import Dict, List, Union
import json
from overrides import overrides
from allennlp.data import DatasetReader, TokenIndexer, Instance
from allennlp.data.fields import TextField, LabelField, Field, MetadataField, ArrayField, ListField
from allennlp.data.token_indexers import SingleIdTokenIndexer, TokenCharactersIndexer
from allennlp.data.tokenizers import Tokenizer, WordTokenizer, Token
from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter, WordSplitter
View backtrace
(gdb) thread apply all backtrace
Thread 17 (Thread 0x7fc90f3ff700 (LWP 3228)):
#0 0x00007fc90fe56945 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00005563e30ed814 in rayon_core::sleep::Sleep::sleep::h403e051017a83b73 ()
#2 0x00005563e30ebd0e in rayon_core::registry::WorkerThread::wait_until_cold::h4c91d94806702f48 ()
#3 0x00005563e30ec54b in rayon_core::registry::main_loop::hbbba263316bb2911 ()
#4 0x00005563e30ed17c in std::panicking::try::do_call::h8a19372e663d596b ()
#5 0x00005563e310c48f in __rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:101
#6 0x00005563e30e983e in _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h24e52bc8c236002e ()
@EntilZha
EntilZha / guess.py
Created Nov 9, 2017
Running Qanta Models
View guess.py
from qanta.guesser.tfidf import TfidfGuesser
guesser = TfidfGuesser.load('output/guesser/qanta.guesser.tfidf.TfidfGuesser')
questions = [
"Name this first president of the united states",
"This man invented the theory of general relativity"
]
n_guesses = 1
View gist:06a8bbd2279d01a61a1c7a5e61d882b4
In [9]: model.predict(np.random.random((10, 3, 2)))
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
---------------------------------------------------------------------------
InvalidArgumentError Traceback (most recent call last)
/home/pedro/anaconda3/lib/python3.6/site-pac
View Cargo.toml
[package]
name = "preferential_attachment"
version = "0.1.0"
[dependencies]
rand = "0.3"
View Results.txt
dummy_element_consumer
data_size: 100, passes: 100
grouper_it_0 3 0.003933991072699428
grouper_it_1 3 0.0036308339331299067
grouper_it_2 3 0.0039052229840308428
grouper_impl 3 0.0020833380986005068
grouper_it_0 10 0.0014350449200719595
grouper_it_1 10 0.0015790120232850313
grouper_it_2 10 0.0019499310292303562
grouper_impl 10 0.001163481967523694
View Jupyter error
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/home/user/.local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
697 type_pprinters=self.type_printers,
698 deferred_pprinters=self.deferred_printers)
--> 699 printer.pretty(obj)
700 printer.flush()
701 return stream.getvalue()
/home/user/.local/lib/python3.5/site-packages/IPython/lib/pretty.py in pretty(self, obj)
View MinByColumn.scala
import org.apache.spark.sql.expressions.MutableAggregationBuffer
import org.apache.spark.sql.expressions.UserDefinedAggregateFunction
import org.apache.spark.sql.Row
import sqlContext.implicits._
import org.apache.spark.sql.types.{StructType, StructField, DataType, ByteType, ShortType, IntegerType, LongType, FloatType, DoubleType, DecimalType, StringType, BinaryType, BooleanType, TimestampType, DateType, ArrayType}
class MinBy(valueType: DataType, minType: DataType) extends UserDefinedAggregateFunction {
def inputSchema: StructType = StructType(StructField("value", valueType) :: StructField("minCol", minType) :: Nil)
def bufferSchema: StructType = StructType(StructField("value", valueType) :: StructField("minCol", minType) :: Nil)
View gist:9c585662ef7cda820c311d1c7eb16e42
[info] Constructing Javadoc information...
[error] /Users/pedro/Documents/Code/spark/core/target/java/org/apache/spark/serializer/SerializationDebugger.java:159: error: cannot find symbol
[error] static private org.apache.spark.serializer.SerializationDebugger.ObjectStreamClassReflection reflect () { throw new RuntimeException(); }
[error] ^
[error] symbol: class ObjectStreamClassReflection
[error] location: class SerializationDebugger
[error] /Users/pedro/Documents/Code/spark/core/target/java/org/apache/spark/serializer/SerializationDebugger.java:22: error: class SerializationDebugger is already defined in package org.apache.spark.serializer
[error] static private class SerializationDebugger {
[error] ^
[error] /Users/pedro/Documents/Code/spark/mllib/target/java/org/apache/spark/ml/PipelineStage.java:6: error: Logging is not public in org.apache.spark.internal; cannot be accessed from outside package
View matplotlib log
This file has been truncated, but you can view the full file.
cd CO% pedro on terminus.local in ~
$ cd Code/matplotlib
pedro on terminus.local in ~/Code/matplotlib (v2.x)
$ python setup.py build
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.1+405.gb6e0b9b]
You can’t perform that action at this time.