Bo1015 commited on
Commit
3905909
·
verified ·
1 Parent(s): 07bc6a4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -4
README.md CHANGED
@@ -32,8 +32,7 @@ from transformers import AutoModelForMaskedLM, AutoModelForSequenceClassificatio
32
  import torch
33
 
34
  tokenizer = AutoTokenizer.from_pretrained("biomap-research/xtrimopglm-1b-mlm", trust_remote_code=True, use_fast=True)
35
- config = AutoConfig.from_pretrained("biomap-research/xtrimopglm-1b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
36
- model = AutoModelForMaskedLM.from_config(config, trust_remote_code=True, torch_dtype=torch.bfloat16)
37
  if torch.cuda.is_available():
38
  model = model.cuda()
39
  model.eval()
@@ -46,10 +45,10 @@ with torch.inference_mode():
46
 
47
 
48
  # model for the sequence-level tasks
49
- model = AutoModelForSequenceClassification.from_config(config, trust_remote_code=True, torch_dtype=torch.bfloat16)
50
 
51
  # model for the token-level tasks
52
- model = AutoModelForTokenClassification.from_config(config, trust_remote_code=True, torch_dtype=torch.bfloat16)
53
 
54
  ```
55
 
 
32
  import torch
33
 
34
  tokenizer = AutoTokenizer.from_pretrained("biomap-research/xtrimopglm-1b-mlm", trust_remote_code=True, use_fast=True)
35
+ model = AutoModelForMaskedLM.from_pretrained("biomap-research/xtrimopglm-1b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
 
36
  if torch.cuda.is_available():
37
  model = model.cuda()
38
  model.eval()
 
45
 
46
 
47
  # model for the sequence-level tasks
48
+ model = AutoModelForSequenceClassification.from_pretrained("biomap-research/xtrimopglm-1b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
49
 
50
  # model for the token-level tasks
51
+ model = AutoModelForTokenClassification.from_pretrained("biomap-research/xtrimopglm-1b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
52
 
53
  ```
54