RaduGabriel commited on
Commit
361c07f
·
verified ·
1 Parent(s): 2fa8a5c

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +19 -11
README.md CHANGED
@@ -9,29 +9,37 @@ This model uses a custom BERT-CRF architecture for token classification, specifi
9
 
10
  ```python
11
  from transformers import AutoTokenizer, AutoModelForTokenClassification
 
12
 
13
- # Load model and tokenizer
14
  model_name = "RaduGabriel/gene-entity-recognition"
15
- tokenizer = AutoTokenizer.from_pretrained(model_name)
16
- model = AutoModelForTokenClassification.from_pretrained(model_name)
17
-
18
- # Example usage for inference
19
- text = "The BRCA1 gene is associated with breast cancer."
20
- inputs = tokenizer(text, return_tensors="pt")
21
- outputs = model(**inputs)
22
- predictions = outputs.logits
 
 
 
 
 
 
 
 
 
23
  ```
24
 
25
  ## Labels
26
  - O
27
  - B-GENE
28
  - I-GENE
29
- - E-GENE
30
 
31
  ## Model Details
32
  - Architecture: BERT-CRF
33
  - Base Model: microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext
34
- - Number of Labels: 4
35
  - CRF Layer: Disabled
36
 
37
  ## Training Details
 
9
 
10
  ```python
11
  from transformers import AutoTokenizer, AutoModelForTokenClassification
12
+ from transformers import pipeline
13
 
 
14
  model_name = "RaduGabriel/gene-entity-recognition"
15
+ hf_token = None
16
+ tokenizer = AutoTokenizer.from_pretrained(model_name, token=hf_token)
17
+ model = AutoModelForTokenClassification.from_pretrained(model_name, token=hf_token)
18
+
19
+ text = "TIF1gamma, a novel member of the transcriptional intermediary factor 1 family, plays a crucial role in gene regulation."
20
+
21
+ # Create NER pipeline
22
+ ner_pipeline = pipeline(
23
+ "ner",
24
+ model=model,
25
+ tokenizer=tokenizer,
26
+ aggregation_strategy="simple"
27
+ )
28
+
29
+
30
+ results = ner_pipeline(text)
31
+ print(results)
32
  ```
33
 
34
  ## Labels
35
  - O
36
  - B-GENE
37
  - I-GENE
 
38
 
39
  ## Model Details
40
  - Architecture: BERT-CRF
41
  - Base Model: microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext
42
+ - Number of Labels: 3
43
  - CRF Layer: Disabled
44
 
45
  ## Training Details