Skip to content

Commit

Permalink
Allow for loading a charlm in finetune mode in the FoundationCache. C…
Browse files Browse the repository at this point in the history
…annot cache the charlm in such a case, for obvious reasons
  • Loading branch information
AngledLuffa committed Jul 2, 2023
1 parent 04a5949 commit 76ea371
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stanza/models/common/foundation_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,15 @@ def load_bert(model_name, foundation_cache=None):
else:
return foundation_cache.load_bert(model_name)

def load_charlm(charlm_file, foundation_cache=None):
def load_charlm(charlm_file, foundation_cache=None, finetune=False):
if not charlm_file:
return None

if finetune:
# can't use the cache in the case of a model which will be finetuned
# and the numbers will be different for other users of the model
return CharacterLanguageModel.load(charlm_file, finetune=True)

if foundation_cache is not None:
return foundation_cache.load_charlm(charlm_file)

Expand Down

0 comments on commit 76ea371

Please sign in to comment.