Downloads · 30 days
6
8% of all-time downloads
svjack/emoji_Mistral7B_v2_lora
emoji_Mistral7B_v2_lora is a machine learning model from svjack. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as other.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
6
8% of all-time downloads
All-time downloads
74
Public
Repo size
178 MB
Likes
0
Public
Click a slice to open those files.
.pt109 MB · 58%
From the Hugging Face model README
pip install peft transformers bitsandbytes
from transformers import TextStreamer, AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("alpindale/Mistral-7B-v0.2-hf",)
mis_model = AutoModelForCausalLM.from_pretrained("alpindale/Mistral-7B-v0.2-hf", load_in_4bit = True)
mis_model = PeftModel.from_pretrained(mis_model, "svjack/emoji_Mistral7B_v2_lora")
mis_model = mis_model.eval()
streamer = TextStreamer(tokenizer)
def mistral_hf_predict(prompt, mis_model = mis_model,
tokenizer = tokenizer, streamer = streamer,
do_sample = True,
top_p = 0.95,
top_k = 40,
max_new_tokens = 512,
max_input_length = 3500,
temperature = 0.9,
repetition_penalty = 1.0,
device = "cuda"):
messages = [
{"role": "user", "content": prompt[:max_input_length]}
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
model_inputs = encodeds.to(device)
generated_ids = mis_model.generate(model_inputs, max_new_tokens=max_new_tokens,
do_sample=do_sample,
streamer = streamer,
top_p = top_p,
top_k = top_k,
temperature = temperature,
repetition_penalty = repetition_penalty,
)
out = tokenizer.batch_decode(generated_ids)[0].split("[/INST]")[-1].replace("</s>", "").strip()
return out
out = mistral_hf_predict('''
对下面的内容添加emoji
走在公园的大道上,可以发现许多树的叶子,已染上了秋的色彩,到处可以看到黄灿灿的树叶。
其中最引人注目的是那金黄金黄的银杏树,远远望去,犹如金色的海洋.
微风吹过,银杏树叶纷纷飘落,就像一只只美丽的蝴蝶,展开双翅在空中飞舞。
''',
repetition_penalty = 1.1)
print(out)
🍃🎊🍂🌞走在公园的大道上,可以发现许多树的叶子,已染上了秋的色彩,到处可以看到黄灿灿的树叶 ☀️。
其中最引人注目的是那金黄金黄的银杏树 🌟,远远望去,犹如金色的海洋 🌊。
微风吹过,银杏树叶纷纷飘落,就像一只只美丽的蝴蝶 🦋,展开双翅在空中飞舞 ✈️
This model is a fine-tuned version of alpindale/Mistral-7B-v0.2-hf on the emoji_add_instruction_zh dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training: