Skip to content

Commit

Permalink
add a clear_cache function!
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Oct 21, 2024
1 parent 5182653 commit 6e0175a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bindings/python/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,16 @@ impl PyBPE {
)?,
)
}

fn clear_cache(self_: PyRef<Self>){
let super_ = self_.as_ref();
let model = super_.model.read().unwrap();
if let ModelWrapper::BPE(ref mo) = *model {
mo.clear_cache()
} else {
unreachable!()
};
}
}

/// An implementation of the WordPiece algorithm
Expand Down

0 comments on commit 6e0175a

Please sign in to comment.