Improve language tag
#2
by
						
lbourdois
	
							
						- opened
							
					
    	
        README.md
    CHANGED
    
    | @@ -1,43 +1,55 @@ | |
| 1 | 
            -
            ---
         | 
| 2 | 
            -
            license: mit
         | 
| 3 | 
            -
            datasets:
         | 
| 4 | 
            -
            - sajjadhadi/disease-diagnosis-dataset
         | 
| 5 | 
            -
            base_model:
         | 
| 6 | 
            -
            - Qwen/Qwen2.5-3B
         | 
| 7 | 
            -
            pipeline_tag: text-classification
         | 
| 8 | 
            -
            tags:
         | 
| 9 | 
            -
            - biology
         | 
| 10 | 
            -
            language:
         | 
| 11 | 
            -
            -  | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 43 | 
             
            print(f"Predicted diagnosis: {model.config.id2label[prediction]}")
         | 
|  | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            license: mit
         | 
| 3 | 
            +
            datasets:
         | 
| 4 | 
            +
            - sajjadhadi/disease-diagnosis-dataset
         | 
| 5 | 
            +
            base_model:
         | 
| 6 | 
            +
            - Qwen/Qwen2.5-3B
         | 
| 7 | 
            +
            pipeline_tag: text-classification
         | 
| 8 | 
            +
            tags:
         | 
| 9 | 
            +
            - biology
         | 
| 10 | 
            +
            language:
         | 
| 11 | 
            +
            - zho
         | 
| 12 | 
            +
            - eng
         | 
| 13 | 
            +
            - fra
         | 
| 14 | 
            +
            - spa
         | 
| 15 | 
            +
            - por
         | 
| 16 | 
            +
            - deu
         | 
| 17 | 
            +
            - ita
         | 
| 18 | 
            +
            - rus
         | 
| 19 | 
            +
            - jpn
         | 
| 20 | 
            +
            - kor
         | 
| 21 | 
            +
            - vie
         | 
| 22 | 
            +
            - tha
         | 
| 23 | 
            +
            - ara
         | 
| 24 | 
            +
            library_name: adapter-transformers
         | 
| 25 | 
            +
            ---
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            # Disease Diagnosis Adapter
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            A fine-tuned adapter for the Qwen/Qwen2.5-3B model specialized in disease diagnosis and classification.
         | 
| 30 | 
            +
            Trained through MLX and MPI, to test performance and accuracy.
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            ## Overview
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            This adapter enhances the base Ministral-3b-instruct model to improve performance on medical diagnosis tasks. It was trained on the [disease-diagnosis-dataset](https://huggingface.co/datasets/sajjadhadi/disease-diagnosis-dataset).
         | 
| 35 | 
            +
            The data is over-saturated in some diagnosis, I limit the number of diagnosis and take a limit number of them as training tags.
         | 
| 36 | 
            +
             | 
| 37 | 
            +
             | 
| 38 | 
            +
            ## Usage
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            ```python
         | 
| 41 | 
            +
            from transformers import AutoModelForSequenceClassification, AutoTokenizer
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            # Load model and tokenizer
         | 
| 44 | 
            +
            model_name = "naifenn/diagnosis-adapter"
         | 
| 45 | 
            +
            model = AutoModelForSequenceClassification.from_pretrained(model_name)
         | 
| 46 | 
            +
            tokenizer = AutoTokenizer.from_pretrained(model_name)
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            # Example input
         | 
| 49 | 
            +
            text = "Patient presents with fever, cough, and fatigue for 3 days."
         | 
| 50 | 
            +
            inputs = tokenizer(text, return_tensors="pt")
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            # Get prediction
         | 
| 53 | 
            +
            outputs = model(**inputs)
         | 
| 54 | 
            +
            prediction = outputs.logits.argmax(-1).item()
         | 
| 55 | 
             
            print(f"Predicted diagnosis: {model.config.id2label[prediction]}")
         | 
