forked from AI4Finance-Foundation/FinGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AI4Finance-Foundation#162 from InvestmentResearchA…
…I/improve-benchmark-data-relative-imports Implement relative importing of data
- Loading branch information
Showing
15 changed files
with
80 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include fingpt/FinGPT_Benchmark/benchmarks/sentiment_templates.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .data.download import download as download_datasets | ||
from . import benchmarks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import fpb, fiqa, finred, fineval, convfinqa, headline, ner, nwgi, tfns | ||
|
||
__all__ = [fpb, fiqa, finred, fineval, convfinqa, headline, ner, nwgi, tfns] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import datasets | ||
from pathlib import Path | ||
import argparse | ||
|
||
DATASETS = [ | ||
# source, destination | ||
(('pauri32/fiqa-2018', None), 'fiqa-2018'), | ||
(('FinGPT/fingpt-finred', None), 'fingpt-finred'), | ||
(('zeroshot/twitter-financial-news-sentiment', None), 'twitter-financial-news-sentiment'), | ||
(('oliverwang15/news_with_gpt_instructions', None), 'news_with_gpt_instructions'), | ||
(('financial_phrasebank', 'sentences_50agree'), 'financial_phrasebank-sentences_50agree'), | ||
(('FinGPT/fingpt-fiqa_qa', None), 'fingpt-fiqa_qa'), | ||
(('FinGPT/fingpt-headline-cls', None), 'fingpt-headline-cls'), | ||
(('FinGPT/fingpt-finred', None), 'fingpt-finred'), | ||
(('FinGPT/fingpt-convfinqa', None), 'fingpt-convfinqa'), | ||
(('FinGPT/fingpt-finred-cls', None), 'fingpt-finred-cls'), | ||
(('FinGPT/fingpt-ner', None), 'fingpt-ner'), | ||
(('FinGPT/fingpt-headline', None), 'fingpt-headline-instruct'), | ||
(('FinGPT/fingpt-finred-re', None), 'fingpt-finred-re'), | ||
(('FinGPT/fingpt-ner-cls', None), 'fingpt-ner-cls'), | ||
(('FinGPT/fingpt-fineval', None), 'fingpt-fineval'), | ||
(('FinGPT/fingpt-sentiment-cls', None), 'fingpt-sentiment-cls'), | ||
] | ||
|
||
def download(no_cache: bool = False): | ||
"""Downloads all datasets to where the FinGPT library is located.""" | ||
data_dir = Path(__file__).parent | ||
|
||
for src, dest in DATASETS: | ||
if Path(data_dir / dest).is_dir() and not no_cache: | ||
print(f"Dataset found at {data_dir / dest}, skipping") | ||
continue | ||
dataset = datasets.load_dataset(*src) | ||
dataset.save_to_disk(data_dir / dest) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--no_cache", default=False, required=False, type=str, help="Redownloads all datasets if set to True") | ||
|
||
args = parser.parse_args() | ||
download(no_cache=args.no_cache) |