Skip to content

Instantly share code, notes, and snippets.

@bhavsarpratik
Created August 31, 2019 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhavsarpratik/129ccffc7d37f4b7509f999be5f5870d to your computer and use it in GitHub Desktop.
Save bhavsarpratik/129ccffc7d37f4b7509f999be5f5870d to your computer and use it in GitHub Desktop.
#Earlier
language_model.get_sentence_embedding(sentence)
#Later
from cachetools import LRUCache, cached
@cached(cache=LRUCache(maxsize=10000))
def get_sentence_embedding(sentence):
return language_model.get_sentence_embedding(sentence)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment