Skip to content

Commit

Permalink
Feat/sort FSRSItem by length to speed up training (#32)
Browse files Browse the repository at this point in the history
* sort FSRSItem by length to speed up training

* correct shape of logits

* cargo fmt

* Create batches with random seq_len

* implement BatchShuffledDataset

* cargo fmt

* rename batch_shuffle & add English comments

* Use an SQL sort and .group_by() for separating by card id

* We don't need InMemDataset

* Move all tests into test modules

This allows easily running all tests in one file at once, and allows
tests to share code that is not used in production.

Also removed the duplicate test_next_stability/difficulty tests.

* Remove redundant test_ prefix/suffix

* Apply cosine_annealing patch from Asuka to fix test

Co-authored-by: Asuka Minato <[email protected]>

* Run tests in CI, except training

Co-authored-by: Asuka Minato <[email protected]>

* Limit checks to pull requests; bust cache

---------

Co-authored-by: Damien Elmes <[email protected]>
Co-authored-by: Asuka Minato <[email protected]>
  • Loading branch information
3 people authored Aug 28, 2023
1 parent ed5b7b4 commit ee7f6be
Show file tree
Hide file tree
Showing 12 changed files with 601 additions and 501 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ cargo fmt --check || (
)

cargo clippy -- -Dwarnings

install -d tests/data/
pushd tests/data/
wget https://github.com/open-spaced-repetition/fsrs-optimizer-burn/files/12394182/collection.anki21.zip
unzip *.zip
SKIP_TRAINING=1 cargo test
5 changes: 2 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Check code
on:
push:
pull_request:

jobs:
Expand All @@ -16,9 +15,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-rust-release-v5-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-rust-release-v6-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-release-v5
${{ runner.os }}-rust-release-v6
${{ runner.os }}-rust-release
- name: Run checks
Expand Down
105 changes: 53 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ rusqlite = { version = "0.29.0" }
chrono = "0.4.26"
chrono-tz = "0.8.3"
itertools = "0.11.0"
rand = "0.8.5"
Loading

0 comments on commit ee7f6be

Please sign in to comment.