Mhammad Ibrahim commited on
Commit
061f0ef
·
1 Parent(s): 311f263

Add accelerate package and simplify model loading

Browse files
Files changed (2) hide show
  1. app.py +1 -2
  2. requirements.txt +2 -1
app.py CHANGED
@@ -15,8 +15,7 @@ tokenizer = AutoTokenizer.from_pretrained("Mhammad2023/bert-finetuned-ner")
15
  model = AutoModelForTokenClassification.from_pretrained(
16
  "Mhammad2023/bert-finetuned-ner",
17
  from_tf=True,
18
- torch_dtype=torch.float32,
19
- device_map="cpu"
20
  )
21
  classifier = pipeline("token-classification", model=model, tokenizer=tokenizer, device="cpu")
22
 
 
15
  model = AutoModelForTokenClassification.from_pretrained(
16
  "Mhammad2023/bert-finetuned-ner",
17
  from_tf=True,
18
+ torch_dtype=torch.float32
 
19
  )
20
  classifier = pipeline("token-classification", model=model, tokenizer=tokenizer, device="cpu")
21
 
requirements.txt CHANGED
@@ -3,4 +3,5 @@ transformers>=4.21.0
3
  torch>=1.12.0
4
  tokenizers>=0.13.0
5
  tensorflow>=2.8.0
6
- tf-keras
 
 
3
  torch>=1.12.0
4
  tokenizers>=0.13.0
5
  tensorflow>=2.8.0
6
+ tf-keras
7
+ accelerate