Downloads · 30 days
29
9% of all-time downloads
liyinghong/DFPO-Gemma2
DFPO-Gemma2 is a text generation model from liyinghong. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
<div align="center" <a href="https://github.com/lyhbio/RAG-ICL-DFPO" target="blank" <img src="DFPO.jpg" width="70%" alt="DFPO" </a </div
Downloads · 30 days
29
9% of all-time downloads
All-time downloads
315
Public
Parameters
9.2B
18.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors18.5 GB · 100%
From the Hugging Face model README
See the snippet below for usage with Transformers:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = 'liyinghong/DFPO-Gemma2'
tokenizer = AutoTokenizer.from_pretrained(mode_path, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(mode_path,
torch_dtype=torch.bfloat16,
device_map="auto")
def predict(user_input):
messages = [
{"role": "user", "content": f"{user_input}"},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
terminators = [tokenizer.eos_token_id]
with torch.no_grad():
outputs = model.generate(
input_ids,
max_new_tokens=512,
eos_token_id=terminators,
do_sample=True,
temperature=0.5,
top_p=0.9,
)
response = outputs[0][input_ids.shape[-1]:]
return tokenizer.decode(response, skip_special_tokens=True)
prompt = """Extract and list the names of all chemicals mentioned in the following text. Provide the output as a single Python list containing the chemicals names as strings.
Do not output anything except for the extracted information. Do not add any clarifying information.\n\n"""
prompt += """Input: Naloxone reverses the antihypertensive effect of clonidine. In unanesthetized, spontaneously hypertensive rats the decrease in blood pressure and heart rate produced by intravenous clonidine, 5 to 20 micrograms/kg, was inhibited or reversed by nalozone, 0.2 to 2 mg/kg. The hypotensive effect of 100 mg/kg alpha-methyldopa was also partially reversed by naloxone. Naloxone alone did not affect either blood pressure or heart rate. In brain membranes from spontaneously hypertensive rats clonidine, 10(-8) to 10(-5) M, did not influence stereoselective binding of [3H]-naloxone (8 nM), and naloxone, 10(-8) to 10(-4) M, did not influence clonidine-suppressible binding of [3H]-dihydroergocryptine (1 nM). These findings indicate that in spontaneously hypertensive rats the effects of central alpha-adrenoceptor stimulation involve activation of opiate receptors. As naloxone and clonidine do not appear to interact with the same receptor site, the observed functional antagonism suggests the release of an endogenous opiate by clonidine or alpha-methyldopa and the possible role of the opiate in the central control of sympathetic tone.
Output:"""
predict(prompt)