Kavyaah commited on
Commit
ac434cc
·
verified ·
1 Parent(s): b83c679

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -10
README.md CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  # Medical Coding LLM
2
 
3
  Predict ICD-10 and CPT codes from clinical notes using a fine-tuned LLM.
@@ -21,18 +30,18 @@ Task: Causal Language Modeling for code prediction
21
  from transformers import AutoTokenizer, AutoModelForCausalLM
22
  import torch, re
23
 
24
- #### Load tokenizer and model
25
- tokenizer = AutoTokenizer.from_pretrained("Kavyaah/medical-coding-llm")
26
- model = AutoModelForCausalLM.from_pretrained("Kavyaah/medical-coding-llm")
27
- model.eval()
28
 
29
- #### Function to predict ICD/CPT codes
30
- def get_code(statement, max_new_tokens=50):
31
- prompt = f"Assign the correct ICD or CPT medical code for this case:\n{statement}\nCode:"
32
- inputs = tokenizer(prompt, return_tensors="pt")
33
- with torch.no_grad():
34
  outputs = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=False)
35
- result = tokenizer.decode(outputs[0], skip_special_tokens=True)
36
 
37
  # Extract code using regex
38
  if "Code:" in result:
 
1
+ ---
2
+ license: mit
3
+ base_model:
4
+ - microsoft/Phi-3-mini-4k-instruct
5
+ tags:
6
+ - Medical
7
+ - MedicalCoding
8
+ - Pharma
9
+ ---
10
  # Medical Coding LLM
11
 
12
  Predict ICD-10 and CPT codes from clinical notes using a fine-tuned LLM.
 
30
  from transformers import AutoTokenizer, AutoModelForCausalLM
31
  import torch, re
32
 
33
+ # Load tokenizer and model
34
+ tokenizer = AutoTokenizer.from_pretrained("Kavyaah/medical-coding-llm")
35
+ model = AutoModelForCausalLM.from_pretrained("Kavyaah/medical-coding-llm")
36
+ model.eval()
37
 
38
+ # Function to predict ICD/CPT codes
39
+ def get_code(statement, max_new_tokens=50):
40
+ prompt = f"Assign the correct ICD or CPT medical code for this case:\n{statement}\nCode:"
41
+ inputs = tokenizer(prompt, return_tensors="pt")
42
+ with torch.no_grad():
43
  outputs = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=False)
44
+ result = tokenizer.decode(outputs[0], skip_special_tokens=True)
45
 
46
  # Extract code using regex
47
  if "Code:" in result: