Working with fasttext

I am working with fasttext to do some sentence classification. I would like to track my experiments and see them in charts but can’t figure out how to do it. I have read the documentation. This is what I have so far:

hyperparamater_defaults = dict(

import wandb
wandb.init(project='imdb', config=hyperparamater_defaults)
config = wandb.config

for epoch in [5, 10, 15]:
  model = fasttext.train_supervised('imdb.train', epoch=epoch, wordNgrams=2)
  _, valid_precision, valid_recall = model.test('imdb.validation')
  wandb.log({'valid_precision': valid_precision, 'epoch': epoch, 'ngram': model.wordNgrams})

I get 3 different charts – it looks like one per hyperparameter. Here they are Weights & Biases

I want to try and get what @stacey has got from her experiments.
Weights & Biases.

  1. How can I determine what wandb config she used please?
  2. How can I get the lr, ngrams, epochs all in one chart as she has managed to do please?

Any help would be much appreciated. Many thanks

1 Like

Can you share a link to your W&B dashboard, or screenshots of the charts you’re getting please?

Right now you’re just logging a single value for valid_precision, epoch and ngram. You need to be calling wandb.log within the training loop to be able to track the loss. I had a quick look around fasttext and can’t really see where to integrate wandb.log into the training loop, but I guess it must be doable! Maybe @stacey might be able to dig up her old code…

(Also, if you surround your code block with back ticks like these: ``` at the beginning and end, it makes it a little easier to read :slight_smile: )

Thanks - I’ve updated the original post and made them available here.

1 Like

Can anyone help, please?

Many thanks

1 Like


I think this is the code Stacey used, you can find it by clicking on one of the runs in her Report and then clicking on the “information” tab for. You can see the specific commit she used in that tab too. I think she used C code to get the logging, so it might be a little tricky to do tbh

1 Like

You will also be able to see the config she logged in that run information page too

1 Like