Skip to content

Instantly share code, notes, and snippets.

View persiyanov's full-sized avatar
🌪️
Focusing

Dmitry Persiyanov persiyanov

🌪️
Focusing
View GitHub Profile
@persiyanov
persiyanov / python_memmap.py
Created March 20, 2018 20:23
python_memmap.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Corpus in the Matrix Market format.
This code uses python's struct library to read/write binary data
@persiyanov
persiyanov / results.md
Last active June 22, 2018 12:25
Word2Vec benchmark without _job_producer with CythonLineSentence
----- MODEL "cython-linesentence-word2vec-window-05-workers-01-size-300" RESULTS -----
       * Vocab time: 126.159779072 sec.
       * Total epoch time: 1181.82512498 sec.
       * Processing speed: 144372.118509 words/sec
       * Avg CPU loads: 0.14, 0.35, 5.27, 94.53, 0.09, 0.23, 0.01, 0.02, 0.02, 0.02, 0.02, 0.01, 0.02, 0.02, 0.33, 0.02
       * Sum CPU load: 101.11282
----- MODEL "cython-linesentence-word2vec-window-05-workers-04-size-300" RESULTS -----
       * Vocab time: 126.206352949 sec.
       * Total epoch time: 305.442888975 sec.
@persiyanov
persiyanov / masked_matmul.py
Created February 8, 2019 12:41
pytorch masked matmul with sparse mask
import torch
import torch.autograd
class MaskedSpMatmul(torch.autograd.Function):
CHUNK_SIZE = 10000
@staticmethod
def forward(ctx, a, b, mask):
"""