Skip to content

Instantly share code, notes, and snippets.

View vlasenkoalexey's full-sized avatar

Aleksey Vlasenko vlasenkoalexey

View GitHub Profile
@vlasenkoalexey
vlasenkoalexey / download_glue_data.py
Created May 19, 2021 22:44
Fixed W4ngatang/download_glue_data.py script to download GLUE data
''' Script for downloading all GLUE data.
Note: for legal reasons, we are unable to host MRPC.
You can either use the version hosted by the SentEval team, which is already tokenized,
or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaphraseCorpus.msi) and extract the data from it manually.
For Windows users, you can run the .msi file. For Mac and Linux users, consider an external library such as 'cabextract' (see below for an example).
You should then rename and place specific files in a folder (see below for an example).
mkdir MRPC
cabextract MSRParaphraseCorpus.msi -d MRPC
import datetime
import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
from IPython.display import clear_output
class TrainTimeCallback(tf.keras.callbacks.Callback):
def on_epoch_begin(self, epoch, logs=None):
self.epoch_start_time = datetime.datetime.now()
@vlasenkoalexey
vlasenkoalexey / test_request_user_project.yaml
Created April 14, 2020 19:06
test_request_user_project.yaml
interactions:
- request:
body: assertion=eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJSUzI1NiIsICJraWQiOiAiMDc3ZWZlNzU3ZWY2M2I5NWJiZTZlM2I0NGNkNTRiZTY4OWIxZDgxNSJ9.eyJpYXQiOiAxNTg2ODkwNzU3LCAiZXhwIjogMTU4Njg5NDM1NywgImlzcyI6ICJhbGVrc2V5di1zZXJ2aWNlQGFsZWtzZXl2LXNjYWxhYmxlYWktZGV2LmlhbS5nc2VydmljZWFjY291bnQuY29tIiwgImF1ZCI6ICJodHRwczovL29hdXRoMi5nb29nbGVhcGlzLmNvbS90b2tlbiIsICJzY29wZSI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9hdXRoL2RldnN0b3JhZ2UuZnVsbF9jb250cm9sIn0.2WDRDml3R-rBoLh4IWQ37T3Q6NEqxKdpiTRbLdShfRPcIR_dYe4C8Ub-R2y99VLen-w4TWs-MmGCVQDFx7nK3HEx2KetgtJMEdo5XpukN8v326HVJKYV0SfF6YtjVS0QNoeRrfi4yXRDeYxJJDyFnYhFU2u7ol59wG8rHTAGUTW6W4nOvVyw1SSLteBLMNY_LFGCsOn6HcbUNJ-ZmI1Nd7vydQNidJkdfffpt-hXHDEDScbZQZUGdZSNJu2-ts_DTmNe2ASKorodrkDthmVUmGwnlSb6LpPXhMCEXp6YAdMV-zyYtjsIqXAdU0IiSUcncqDAgZtXQH9N70WvY2bUuA&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
def train_estimator_linear(model_dir):
global ARGS
logging.info('training for {} steps'.format(get_max_steps()))
config = tf.estimator.RunConfig().replace(save_summary_steps=10)
hooks = []
if ARGS.profiler:
profiler_hook = tf.estimator.ProfilerHook(
save_steps=get_training_steps_per_epoch(),
@vlasenkoalexey
vlasenkoalexey / bigquerystorage_py_grpc_local
Created October 10, 2019 17:21
log file when referencing bigquerystorage_py_grpc rule defined in local repository but proto defined in remote one
INFO: Found 79 targets...
SUBCOMMAND: # @com_google_googleapis//google/cloud/bigquery/storage/v1beta1:_bigquerystorage_py_grpc_grpc_codegen [action 'CopySourceProto external/com_google_googleapis/google/cloud/bigquery/storage/v1beta1/arrow.proto']
(cd /root/.cache/bazel/_bazel_root/a7ecd8237744645c5d189c197108d6d2/execroot/org_tensorflow_io &&
exec env -
/bin/bash -c 'cp external/com_google_googleapis/google/cloud/bigquery/storage/v1beta1/arrow.proto bazel-out/k8-opt/bin/external/com_google_googleapis/google/cloud/bigquery/storage/v1beta1/arrow.proto')
SUBCOMMAND: # @com_google_googleapis//google/cloud/bigquery/storage/v1beta1:_bigquerystorage_py_grpc_grpc_codegen [action 'CopySourceProto external/com_google_googleapis/google/cloud/bigquery/storage/v1beta1/storage.proto']
(cd /root/.cache/bazel/_bazel_root/a7ecd8237744645c5d189c197108d6d2/execroot/org_tensorflow_io &&
exec env -
/bin/bash -c 'cp external/com_google_googleapis/google/cloud/bigquery/storage/v1beta1/storage.proto bazel-out/k8-opt/bin/external/co
@vlasenkoalexey
vlasenkoalexey / bigquerystorage_py_grpc_remote
Created October 10, 2019 17:19
log file when referencing bigquerystorage_py_grpc rule defined in remote repository
INFO: Analyzed 83 targets (0 packages loaded, 0 targets configured).
INFO: Found 83 targets...
SUBCOMMAND: # //tensorflow_io/bigquery:_bigquerystorage_py_proto_codegen [action 'ProtocInvocation tensorflow_io/bigquery/arrow_pb2.py']
(cd /root/.cache/bazel/_bazel_root/a7ecd8237744645c5d189c197108d6d2/execroot/org_tensorflow_io &&
exec env -
bazel-out/host/bin/external/com_google_protobuf/protoc '--python_out=bazel-out/k8-opt/bin' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=bazel-out/k8-opt/bin/external/com_google_protobuf' '--proto_path=external/com_google_googleapis' '--proto_path=external/com_google_googleapis' '--proto_path=bazel-out/k8-opt/bin/external/com_google_protobuf' '--proto_path=bazel-out/k8-opt/bin/external/com_
-module(frequency_supervisor).
-export([start/0,stop/0]).
-export([init/0]).
start() ->
register(frequency_supervisor, spawn(frequency_supervisor, init, [])).
stop() ->
frequency_supervisor ! stop.
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
%% cd("C:/Users/Alexey/Documents/ErlangClass").
-module(frequency).