From a61e8af79852d852bfe2d9869a8ee8b8005cb6a6 Mon Sep 17 00:00:00 2001 From: bunyamin-polat Date: Thu, 25 May 2023 19:12:16 +0700 Subject: [PATCH 1/2] Add model 2023-05-25-fingen_flant5_finetuned_alpaca_en --- ...05-25-fingen_flant5_finetuned_alpaca_en.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md diff --git a/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md b/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md new file mode 100644 index 0000000000..4bb377dfa9 --- /dev/null +++ b/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md @@ -0,0 +1,89 @@ +--- +layout: model +title: Financial Finetuned FLAN-T5 Text Generation ( Financial Alpaca ) +author: John Snow Labs +name: fingen_flant5_finetuned_alpaca +date: 2023-05-25 +tags: [en, finance, generation, licensed, flant5, alpaca, tensorflow] +task: Text Generation +language: en +edition: Finance NLP 1.0.0 +spark_version: 3.0 +supported: true +engine: tensorflow +annotator: FinanceTextGenerator +article_header: + type: cover +use_language_switcher: "Python-Scala-Java" +--- + +## Description + +The `fingen_flant5_finetuned_alpaca` model is the Text Generation model that has been fine-tuned on FLAN-T5 using Financial Alpaca dataset. FLAN-T5 is a state-of-the-art language model developed by Facebook AI that utilizes the T5 architecture for text-generation tasks. + +{:.btn-box} + + +[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/finance/models/fingen_flant5_finetuned_alpaca_en_1.0.0_3.0_1685016665729.zip){:.button.button-orange.button-orange-trans.arr.button-icon.hidden} +[Copy S3 URI](s3://auxdata.johnsnowlabs.com/finance/models/fingen_flant5_finetuned_alpaca_en_1.0.0_3.0_1685016665729.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3} + +## How to use + + + +
+{% include programmingLanguageSelectScalaPythonNLU.html %} +```python + +document_assembler = nlp.DocumentAssembler()\ + .setInputCol("text")\ + .setOutputCol("document") + +flant5 = finance.TextGenerator.pretrained("fingen_flant5_finetuned_alpaca", "en", "finance/models")\ + .setInputCols(["document"])\ + .setOutputCol("generated")\ + .setMaxNewTokens(256)\ + .setStopAtEos(True)\ + .setDoSample(True)\ + .setTopK(3) + +pipeline = nlp.Pipeline(stages=[document_assembler, flant5]) + +data = spark.createDataFrame([ + [1, "What is the US Fair Tax?"]]).toDF('id', 'text') + +results = pipeline.fit(data).transform(data) + +results.select("generated.result").show(truncate=False) + +``` + +
+ +## Results + +```bash + ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|result | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|[Fair tax in the US is essentially an income tax. Fair taxes are tax on your income, and are not taxeable in any country. Fair taxes are taxed as income. If you have a net gain or if the loss of income from taxable activities is less then the fair value (the loss) of your gross income (the loss) then you have to file an Income Report. This will give the US government an overview and give you an understanding. If your net income is less that your fair share of your gross income (which you are entitled) you have the right to claim a refund.]| ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +``` + +{:.model-param} +## Model Information + +{:.table-model} +|---|---| +|Model Name:|fingen_flant5_finetuned_alpaca| +|Compatibility:|Finance NLP 1.0.0+| +|License:|Licensed| +|Edition:|Official| +|Language:|en| +|Size:|1.6 GB| + +## References + +The dataset is available [here](https://huggingface.co/datasets/gbharti/finance-alpaca/viewer/gbharti--finance-alpaca) \ No newline at end of file From a2ec9e1fcc9b34ad7a9dc482f9e4bfe96221d905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=BCnyamin=20Polat?= <78386903+bunyamin-polat@users.noreply.github.com> Date: Thu, 25 May 2023 15:14:22 +0300 Subject: [PATCH 2/2] Update 2023-05-25-fingen_flant5_finetuned_alpaca_en.md --- .../2023-05-25-fingen_flant5_finetuned_alpaca_en.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md b/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md index 4bb377dfa9..6b303e5b32 100644 --- a/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md +++ b/docs/_posts/bunyamin-polat/2023-05-25-fingen_flant5_finetuned_alpaca_en.md @@ -33,6 +33,7 @@ The `fingen_flant5_finetuned_alpaca` model is the Text Generation model that has
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python document_assembler = nlp.DocumentAssembler()\ @@ -86,4 +87,4 @@ results.select("generated.result").show(truncate=False) ## References -The dataset is available [here](https://huggingface.co/datasets/gbharti/finance-alpaca/viewer/gbharti--finance-alpaca) \ No newline at end of file +The dataset is available [here](https://huggingface.co/datasets/gbharti/finance-alpaca/viewer/gbharti--finance-alpaca)