Skip to content

Commit

Permalink
Merge pull request #1979 from flairNLP/add-flair-seed
Browse files Browse the repository at this point in the history
global: add possibility to set flair seed
  • Loading branch information
alanakbik authored Nov 23, 2020
2 parents 79014b0 + d2c75d1 commit 43b3802
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flair/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import torch
from pathlib import Path
from transformers import set_seed as hf_set_seed

# global variable: cache_root
cache_root = os.getenv('FLAIR_CACHE_ROOT', Path(Path.home(), ".flair"))
Expand Down Expand Up @@ -46,3 +47,6 @@
)

logger = logging.getLogger("flair")

def set_seed(seed: int):
hf_set_seed(seed)

0 comments on commit 43b3802

Please sign in to comment.