transformers safetensors mistral text-generation medical biology conversational fr en de es dataset:nuvocare/MSD_instruct license:apache-2.0 autotrain_compatible text-generation-inference endpoints_compatible region:us
---
datasets:
- nuvocare/MSD_instruct
language:
- fr
- en
- de
- es
library_name: transformers
license: apache-2.0
pipeline_tag: text-generation
tags:
- medical
- biology
---

# Model Card for NuvoChat

## Model Details

NuvoChat is a fine-tuned version of the Mistral-7b-Instruct-v0.2 on a medical domain. The fine-tuning was done with LoRA and a quantized version of the model. The Lora was then merged back into the original model to get a standalone one.


### Model Description


- **Developed by:** [Samuel Caineau, Nuvocare](https://www.linkedin.com/in/samuel-chaineau-734b13122/)
- **Funded by [Nuvocare]:** [Nuvocare](https://www.nuvocare.fr/)
- **Language(s) (NLP):** English, French, Spanish and German
- **Finetuned from model [Mistral 7B Instruct v0.2]:** [Base model](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)

## Uses


### Direct Use

NuvoChat is made to assist patients and clinicians by providing relevant, adapted and clear information. The model knows how to adapt effectively its tone and vocabulary absed on the user's background.
This is done by providing the model with a specific template where the status of the user (patient or professionnals) is explicitly provided.

The model can be used for:
- Chatting with patients (with or without a RAG set-up)
- Chatting with clinicians (with or without a RAG set-up)
- Medical explanation translation

### Downstream Use [optional]

The model can be used for text summarization. 

## Bias, Risks, and Limitations

The model is trained on an unknown dataset by Mistral and fine-tuned on a multilingual dataset from MSD. The model might have different performances depending on the language used.

## How to Get Started with the Model

Use the code below to get started with the model.

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained("nuvocare/NuvoChat", device = "auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")

prompt = "[INST] Je suis un patient qui souhaite connaitre des informations sur la chirurgie de la cataracte [/INST]"

input = tokenizer(prompt).to("cuda")

answer = tokenizer.decode(model.generate(**input, max_new_tokens = 200, pad_token = tokenizer.eos_token)[0])
```

## Training Details

### Training Data

You can check dataset card.

### Training Procedure

Trained over 7000 steps with a total batch size of 32 (corresponding to a bit more than 1 epoch) and a sequence length of 2048.