Skip to content

Repository files navigation

Student repo for CBOW and Skip-gram Word2Vec with a GitHub Pages leaderboard.

What to implement

Main homework: complete the TODOs in skipgram_homework.py.

  • SkipGramDataset: build (center_word_id, context_word_id) pairs.
  • SkipGramWord2Vec: define self.embedding and self.output.
  • forward: turn center ids into vocabulary logits.

CBOW is already implemented in cbow_word2vec.py and can also be submitted.

Objectives

Skip-gram minimizes cross-entropy for predicting a nearby context word from the center word.

CBOW minimizes cross-entropy for predicting the center word from its surrounding context words.

Leaderboard ranking uses held-out accuracy; lower loss breaks ties.

Train

Skip-gram:

python skipgram_homework.py --epochs 3

CBOW:

python cbow_word2vec.py --epochs 3

Keep the starter defaults for leaderboard-compatible checkpoints: vocab size 5000, window size 2, max tokens 200000, validation fraction 0.2.

Submit

Install dependencies if needed:

pip install -r requirements.txt

Score without saving by omitting --name:

python submit.py --model skipgram
python submit.py --model cbow --file cbow_submission.pt

You can also force test-only mode with a name:

python submit.py --name "your-name" --model skipgram --score-only
python submit.py --name "your-name" --model cbow --file cbow_submission.pt --score-only

Publish by adding a name:

python submit.py --name "your-name" --model skipgram
python submit.py --name "your-name" --model cbow --file cbow_submission.pt

Leaderboard page: https://tues-ai.github.io/word2vec/

Repo layout

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages