Views
No views yet
h2oai/h2o-danube3-500m-chat, specifically adapted for analyzing and interpreting textual reports from the Conners' Continuous Performance Test II (CPT-II). It has been trained using Low-Rank Adaptation (LoRA) on a dataset of CPT-II results to identify patterns relevant to the assessment of ADHD.h2oai/h2o-danube3-500m-chat) and then apply the LoRA adapter.1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3from peft import PeftModel
4
5# Model and repository parameters
6base_model_id = "h2oai/h2o-danube3-500m-chat"
7adapter_id = "monkwarrior08/adhd-cpt-analyst"
8
9# Load tokenizer and base model
10tokenizer = AutoTokenizer.from_pretrained(base_model_id)
11base_model = AutoModelForCausalLM.from_pretrained(
12 base_model_id,
13 torch_dtype=torch.bfloat16,
14 device_map="auto",
15)
16
17# Load the LoRA adapter
18model = PeftModel.from_pretrained(base_model, adapter_id)
19model.eval()
20
21# Create a prompt with a patient's data
22patient_report = """
23Patient ID: 3.0
24Assessment Status: 3.0
25Assessment Duration: 839999.0 seconds
26
27CPT II Summary Report:
28- Omissions:
29 - General T-Score: 78.75
30 - ADHD T-Score: 70.25
31 - Raw Score: 11.0
32- Commissions:
33 - General T-Score: 65.98
34 - ADHD T-Score: 70.89
35 - Raw Score: 28.0
36- Hit Reaction Time (HitRT):
37 - General T-Score: 36.57
38 - Mean Reaction Time: 325.20 ms
39ADHD Confidence Index: 86.87
40"""
41
42prompt = f"<|prompt|>Analyze this CPT-II report and summarize the findings for potential indicators of ADHD.:\\n{patient_report}<|end|><|answer|>"
43
44# Generate a response
45inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
46outputs = model.generate(
47 **inputs,
48 max_new_tokens=256,
49 eos_token_id=tokenizer.eos_token_id,
50 do_sample=True,
51 temperature=0.6,
52 top_p=0.9,
53)
54
55response = tokenizer.decode(outputs[0], skip_special_tokens=True)
56
57# Extract only the model's answer
58answer = response.split('<|answer|>')[1].strip()
59print(answer)ADHD Diagnosis CPT II Data.csv file. Each record was converted into a textual summary containing the following key metrics:trl library's SFTTrainer with a LoRA configuration. The primary goal was to teach the model to understand the relationship between the various CPT-II metrics and their relevance in ADHD assessment.1@software{monkwarrior08_2024_adhd_cpt_analyst,
2 author = {monkwarrior08},
3 title = {ADHD CPT Analyst: A Fine-tuned Language Model for CPT-II Report Interpretation},
4 month = {8},
5 year = {2024},
6 url = {https://huggingface.co/monkwarrior08/adhd-cpt-analyst}
7}