Skip to content

Commit

Permalink
fix training script
Browse files Browse the repository at this point in the history
  • Loading branch information
npedrazzini committed Jul 13, 2023
1 parent 435cce5 commit eb6ccd7
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions scripts/training/train_diach_emb.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from gensim.models import Word2Vec
from tqdm import tqdm
import timeit
from .utils import stopwdsrm, cleantxt, smart_procrustes_align_gensim
from utils import stopwdsrm, cleantxt, smart_procrustes_align_gensim

# ------------------- Start timing the whole process --------------------

Expand All @@ -61,23 +61,21 @@
skip_alignment = configs['alignment']['skip']

## -- Preprocessing
if skip_preprocessing == False:
savepreprocessed = configs['preprocessing']['savepreprocessed']
minwordlength = configs['preprocessing']['pipelines']['minwordlength']
lowercase = configs['preprocessing']['pipelines']['lowercase']
remove_punctuation = configs['preprocessing']['pipelines']['remove_punctuation']
remove_stopwords = configs['preprocessing']['pipelines']['remove_stopwords']
savepreprocessed = configs['preprocessing']['savepreprocessed']
minwordlength = configs['preprocessing']['pipelines']['minwordlength']
lowercase = configs['preprocessing']['pipelines']['lowercase']
remove_punctuation = configs['preprocessing']['pipelines']['remove_punctuation']
remove_stopwords = configs['preprocessing']['pipelines']['remove_stopwords']

## -- Training
if skip_training == False:
epochs = configs['training']['options']['epochs']
vector_size = configs['training']['options']['vector_size']
sg = configs['training']['options']['sg']
min_count = configs['training']['options']['min_count']
window = configs['training']['options']['window']
start_alpha = configs['training']['options']['start_alpha']
end_alpha = configs['training']['options']['end_alpha']
workers = configs['training']['options']['workers']
epochs = configs['training']['options']['epochs']
vector_size = configs['training']['options']['vector_size']
sg = configs['training']['options']['sg']
min_count = configs['training']['options']['min_count']
window = configs['training']['options']['window']
start_alpha = configs['training']['options']['start_alpha']
end_alpha = configs['training']['options']['end_alpha']
workers = configs['training']['options']['workers']

# ------------------- Create dirs if needed --------------------

Expand Down Expand Up @@ -200,7 +198,7 @@
model1.save('./outputs/{}/aligned/{}'.format(namethetest,model1_name))

# --- Aligned each of the models to the model for the last time slice
for model in allmodels[:-2]:
for model in allmodels[:-1]:

model2_name = model.split('/')[-1]
print('Now aligning {} to {}...'.format(model1_name,model2_name))
Expand Down

0 comments on commit eb6ccd7

Please sign in to comment.