Update README.md
Browse files
README.md
CHANGED
@@ -1,10 +1,87 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
|
|
|
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
- PEFT 0.5.0
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
## Model info
|
5 |
+
- Base model: Falcon-7B
|
6 |
+
- Training method: Instruction Fine-tuning + LoRA
|
7 |
+
- Task: Sentiment Analysis
|
8 |
|
9 |
+
## Packages
|
10 |
+
``` python
|
11 |
+
!pip install transformers==4.32.0 peft==0.5.0
|
12 |
+
!pip install sentencepiece
|
13 |
+
!pip install accelerate
|
14 |
+
!pip install torch
|
15 |
+
!pip install peft
|
16 |
+
!pip install datasets
|
17 |
+
!pip install bitsandbytes
|
18 |
+
```
|
19 |
|
20 |
+
## Inference: [Inference Code](https://github.com/AI4Finance-Foundation/FinGPT/blob/master/FinGPT_Inference_Llama2_13B_falcon_7B_for_Beginners.ipynb)
|
21 |
+
``` python
|
22 |
+
FROM_REMOTE=True
|
23 |
|
24 |
+
base_model = 'falcon'
|
25 |
+
peft_model = 'FinGPT/fingpt-mt_falcon-7b_lora' if FROM_REMOTE else 'finetuned_models/MT-falcon-linear_202309210126'
|
26 |
+
|
27 |
+
model, tokenizer = load_model(base_model, peft_model, FROM_REMOTE)
|
28 |
+
|
29 |
+
|
30 |
+
demo_tasks = [
|
31 |
+
'Financial Sentiment Analysis',
|
32 |
+
'Financial Relation Extraction',
|
33 |
+
'Financial Headline Classification',
|
34 |
+
'Financial Named Entity Recognition',
|
35 |
+
]
|
36 |
+
demo_inputs = [
|
37 |
+
"Glaxo's ViiV Healthcare Signs China Manufacturing Deal With Desano",
|
38 |
+
"Apple Inc Chief Executive Steve Jobs sought to soothe investor concerns about his health on Monday, saying his weight loss was caused by a hormone imbalance that is relatively simple to treat.",
|
39 |
+
'gold trades in red in early trade; eyes near-term range at rs 28,300-28,600',
|
40 |
+
'This LOAN AND SECURITY AGREEMENT dated January 27 , 1999 , between SILICON VALLEY BANK (" Bank "), a California - chartered bank with its principal place of business at 3003 Tasman Drive , Santa Clara , California 95054 with a loan production office located at 40 William St ., Ste .',
|
41 |
+
]
|
42 |
+
demo_instructions = [
|
43 |
+
'What is the sentiment of this news? Please choose an answer from {negative/neutral/positive}.',
|
44 |
+
'Given phrases that describe the relationship between two words/phrases as options, extract the word/phrase pair and the corresponding lexical relationship between them from the input text. The output format should be "relation1: word1, word2; relation2: word3, word4". Options: product/material produced, manufacturer, distributed by, industry, position held, original broadcaster, owned by, founded by, distribution format, headquarters location, stock exchange, currency, parent organization, chief executive officer, director/manager, owner of, operator, member of, employer, chairperson, platform, subsidiary, legal form, publisher, developer, brand, business division, location of formation, creator.',
|
45 |
+
'Does the news headline talk about price going up? Please choose an answer from {Yes/No}.',
|
46 |
+
'Please extract entities and their types from the input sentence, entity types should be chosen from {person/organization/location}.',
|
47 |
+
]
|
48 |
+
|
49 |
+
test_demo(model, tokenizer)
|
50 |
+
|
51 |
+
```
|
52 |
+
|
53 |
+
## Inference Results:
|
54 |
+
|
55 |
+
==== Financial Sentiment Analysis ====
|
56 |
+
|
57 |
+
Instruction: What is the sentiment of this news? Please choose an answer from {negative/neutral/positive}.
|
58 |
+
|
59 |
+
Input: Glaxo's ViiV Healthcare Signs China Manufacturing Deal With Desano
|
60 |
+
|
61 |
+
Answer: positive
|
62 |
+
|
63 |
+
==== Financial Relation Extraction ====
|
64 |
+
|
65 |
+
Instruction: Given phrases that describe the relationship between two words/phrases as options, extract the word/phrase pair and the corresponding lexical relationship between them from the input text. The output format should be "relation1: word1, word2; relation2: word3, word4". Options: product/material produced, manufacturer, distributed by, industry, position held, original broadcaster, owned by, founded by, distribution format, headquarters location, stock exchange, currency, parent organization, chief executive officer, director/manager, owner of, operator, member of, employer, chairperson, platform, subsidiary, legal form, publisher, developer, brand, business division, location of formation, creator.
|
66 |
+
|
67 |
+
Input: Apple Inc Chief Executive Steve Jobs sought to soothe investor concerns about his health on Monday, saying his weight loss was caused by a hormone imbalance that is relatively simple to treat.
|
68 |
+
|
69 |
+
Answer: employer: Steve Jobs, Apple Inc
|
70 |
+
|
71 |
+
==== Financial Headline Classification ====
|
72 |
+
|
73 |
+
Instruction: Does the news headline talk about price going up? Please choose an answer from {Yes/No}.
|
74 |
+
|
75 |
+
Input: gold trades in red in early trade; eyes near-term range at rs 28,300-28,600
|
76 |
+
|
77 |
+
Answer: No
|
78 |
+
|
79 |
+
==== Financial Named Entity Recognition ====
|
80 |
+
|
81 |
+
Instruction: Please extract entities and their types from the input sentence, entity types should be chosen from {person/organization/location}.
|
82 |
+
|
83 |
+
Input: This LOAN AND SECURITY AGREEMENT dated January 27, 1999, between SILICON VALLEY BANK (" Bank "), a California - chartered bank with its principal place of business at 3003 Tasman Drive, Santa Clara, California 95054 with a loan production office located at 40 William St., Ste.
|
84 |
+
|
85 |
+
Answer: SILICON VALLEY BANK is an organization, Bank is an organization, California is a location, bank is an organization, 3003 Tasman Drive is a location, Santa Clara is a location, California is a location, 40 William St is a location.
|
86 |
|
87 |
- PEFT 0.5.0
|