Quantized GGUF model files for
phi-2-meditron from
malhajar
phi-2-meditron is a finetuned version of
epfl-llm/meditron-7b using SFT Training on the Meditron Dataset.
This model can answer information about different excplicit ideas in medicine (see
epfl-llm/meditron-7b for more info)
### Instruction:
<prompt> (without the <>)
### Response:
Use the code sample provided in the original post to interact with the model.
1 from transformers import AutoTokenizer , AutoModelForCausalLM
2
3 model_id = "malhajar/phi-2-meditron"
4 model = AutoModelForCausalLM . from_pretrained ( model_name_or_path ,
5 device_map = "auto" ,
6 torch_dtype = torch . float16 ,
7 trust_remote_code = True ,
8 revision = "main" )
9
10 tokenizer = AutoTokenizer . from_pretrained ( model_id )
11
12 question : "what is tract infection?"
13 # For generating a response
14 prompt = '''
15 ### Instruction:
16 {question}
17
18 ### Response:'''
19 input_ids = tokenizer ( prompt , return_tensors = "pt" ) . input_ids
20 output = model . generate ( inputs = input_ids , max_new_tokens = 512 , pad_token_id = tokenizer . eos_token_id , top_k = 50 , do_sample = True ,
21 top_p = 0.95 )
22 response = tokenizer . decode ( output [ 0 ] )
23
24 print ( response )