HMPhuoc commited on
Commit
5f2b86f
1 Parent(s): 041b0de

add __main__

Browse files
Files changed (1) hide show
  1. phoBERT.py +2 -0
phoBERT.py CHANGED
@@ -1,6 +1,7 @@
1
  import torch
2
  from transformers import AutoModel, AutoTokenizer
3
  from underthesea import word_tokenize
 
4
 
5
  #phobert = AutoModel.from_pretrained("vinai/phobert-base")
6
  tokenizer = AutoTokenizer.from_pretrained("./")
@@ -31,6 +32,7 @@ class PhoBertModel(torch.nn.Module):
31
  return output
32
 
33
  def getModel():
 
34
  model = torch.load('phoBertModel.pth', map_location=torch.device('cpu'))
35
  model.eval()
36
  return model
 
1
  import torch
2
  from transformers import AutoModel, AutoTokenizer
3
  from underthesea import word_tokenize
4
+ import __main__
5
 
6
  #phobert = AutoModel.from_pretrained("vinai/phobert-base")
7
  tokenizer = AutoTokenizer.from_pretrained("./")
 
32
  return output
33
 
34
  def getModel():
35
+ __main__.PhoBertModel = PhoBertModel
36
  model = torch.load('phoBertModel.pth', map_location=torch.device('cpu'))
37
  model.eval()
38
  return model