Skip to content

Instantly share code, notes, and snippets.

View avidale's full-sized avatar

David Dale avidale

View GitHub Profile
@avidale
avidale / inequality-constraints-in-linear-regression.ipynb
Last active May 25, 2023 21:24
inequality constraints in linear regression.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
повторение мать учения
нет
настанет час
давай
1 шаг
повторить
потехе час
да
а дома лучше
играем
@avidale
avidale / compress.py
Last active May 25, 2023 21:24
Compress fasttext model by applying denser ngram hash
# based on Andrey Vasnetsov code: https://gist.github.com/generall/68fddb87ae1845d6f54c958ed3d0addb
import os
import numpy as np
import gensim
from collections import defaultdict
from copy import deepcopy
from gensim.models.utils_any2vec import ft_ngram_hashes
from tqdm.auto import tqdm, trange

Как сжать модель fastText в 100 раз

Модель fastText - одно из самых эффективных векторных представлений слов для русского языка. Однако её прикладная польза страдает из-за внушительных (несколько гигабайт) размеров модели. В этой статье мы показываем, как можно уменьшить модель fastText до пары десятков мегабайт, не слишком потеряв в её качестве. Спойлер: квантизация и отбор признаков работают хорошо, а матричные разложения - не очень. Также мы публикуем пакет на Python для этого сжатия и пример компактной модели для русских слов.

Зачем и о чём это

Я не первый, кто пытается это сжать fastText: сами разработчики fastText давно предусмотрели этот режим для своих классификаторов, сжимая их на порядк

@avidale
avidale / fasttext_similarity_weirdness.ipynb
Last active May 25, 2023 21:24
fasttext_similarity_weirdness.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avidale
avidale / bert_knn.ipynb
Last active February 11, 2024 16:08
bert_knn.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avidale
avidale / covid-trends.ipynb
Last active May 25, 2023 21:25
covid-trends.ipynb
@avidale
avidale / pyahocorasick-entity-search.ipynb
Last active May 25, 2023 21:25
pyahocorasick entity search.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avidale
avidale / convert-conjuction-to-separate-phrases.ipynb
Last active May 25, 2023 21:25
convert conjuction to separate phrases
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avidale
avidale / subparagraphs.ipynb
Last active May 25, 2023 21:25
subparagraphs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.