Views
No views yet
1pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
2pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes1from unsloth import FastLanguageModel
2from transformers import AutoModel, TextStreamer
3from peft import PeftModel, PeftConfig
4
5# Load base model
6model_name = "unsloth/llama-3-8b-bnb-4bit"
7base_model, tokenizer = FastLanguageModel.from_pretrained(
8 model_name=model_name,
9 max_seq_length=2048,
10 load_in_4bit=True
11)
12
13# Load adapter configuration
14adapter_name = "Abiral7/FinAssistant"
15peft_config = PeftConfig.from_pretrained(adapter_name)
16
17# Apply adapter to base model
18model = PeftModel.from_pretrained(base_model, adapter_name)
19
20FastLanguageModel.for_inference(model) # Enable native 2x faster inference
21
22# Example usage
23inputs = tokenizer(
24[
25
26""" #System:
27
28 You are a Financial LLM, that has knowledge in the Financial Industry and can do Financial Analysis.
29 Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content.
30 Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct.
31 If you don't know the answer to a question, please don't share false information.
32
33
34
35 #User:
36
37 Investor performance chart: The subsequent chart and accompanying data are not considered "soliciting material" or "filed" with the SEC. This information should not be incorporated by reference into future filings under the Securities Act of 1933 or Securities Exchange Act of 1934, as amended, unless explicitly incorporated by the company. The chart depicts a 5-year comparison of cumulative total investor returns for our Class B common stock, S&P 500 index, and Dow Jones Transportation Average. It compares total cumulative return on investment (quarterly stock price changes plus reinvested dividends) assuming $100 invested on 12/31/2001 in each.
38 Cumulative 5-year return comparison:
39 [Chart values from $40 to $200, years 2001-2006]
40 S&P 500, UPS, DJ Transport lines
41 Data table:
42 Date | UPS | S&P 500 | DJ Transport
43 12/31/01 | $100.00 | $100.00 | $100.00
44 12/31/02 | $117.19 | $77.90 | $88.52
45 12/31/03 | $140.49 | $100.24 | $116.70
46 12/31/04 | $163.54 | $111.15 | $149.06
47 12/31/05 | $146.35 | $116.61 | $166.42
48 12/31/06 | $148.92 | $135.02 | $182.76
49 Equity compensation plan information: As of 12/31/2006, the following data pertains to plans authorizing our Class A common stock issuance. Class B common stock is not authorized under these plans. What was UPS Inc.'s return in 2006? 148.92 and what was the change in UPS Inc.'s return from 2001 to 2006?
50
51
52 #Assistant
53
54
55 """
56], return_tensors = "pt").to("cuda")
57
58from transformers import TextStreamer
59text_streamer = TextStreamer(tokenizer)
60_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 5000)