Views
No views yet
⚠️ This is a LoRA adapter, not a standalone model. You must load the base Mistral-7B-Instruct-v0.3 model first and apply this adapter on top.
pip install transformers peft torch accelerate1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
4base_model_id = "mistralai/Mistral-7B-Instruct-v0.3"
5
6tokenizer = AutoTokenizer.from_pretrained(base_model_id)
7model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map="auto")
8
9# Apply the LoRA adapter
10model = PeftModel.from_pretrained(model, "OmsinghRotele/finance-tech-mistral-7b")
11
12question = "What is a P/E ratio and how is it used in stock analysis?"
13generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
14output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
15print(output["generated_text"])1@software{vonwerra2020trl,
2 title = {{TRL: Transformers Reinforcement Learning}},
3 author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
4 license = {Apache-2.0},
5 url = {https://github.com/huggingface/trl},
6 year = {2020}
7}