Skip to content

Instantly share code, notes, and snippets.

View AlexKay28's full-sized avatar
:electron:
Focusing

Alexander Kaigorodov AlexKay28

:electron:
Focusing
View GitHub Profile
@AlexKay28
AlexKay28 / fasttext_model_reduce_dim.py
Last active November 5, 2021 15:24
Reduce fasttext model vector size
import fasttext
import fasttext.util
from argparse import ArgumentParser
# fasttext v0.9.2
# https://github.com/AlexKay28
def main(model_path, to_size, new_model_path):
"""
Reduce vectors size in fasttext model
@AlexKay28
AlexKay28 / getInOut_wrapper.py
Last active October 2, 2021 18:10
Get in-out wrapper for function
import os
def getInOut(orig_fun=None, path_in=None, path_out=None):
def _decorate(fun):
@functools.wraps(fun)
def wrapper(*args, **kwargs):
os.chdir(path_in)
fun(*args, **kwargs)
os.chdir(path_out)