louisbrulenaudet commited on
Commit
fcc6ad1
1 Parent(s): 028de94

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +96 -56
README.md CHANGED
@@ -10,74 +10,114 @@ pinned: true
10
  license: apache-2.0
11
  short_description: Pearl-7B, an xtraordinary Space
12
  ---
13
-
14
- # MANATEE(lm) : Market Analysis based on language model architectures
15
- [![Python](https://img.shields.io/pypi/pyversions/tensorflow.svg)](https://badge.fury.io/py/tensorflow) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Maintainer](https://img.shields.io/badge/maintainer-@louisbrulenaudet-blue)
16
-
17
- This project focuses on employing LLM to analyze time series data for forecasting purposes, based on the "Chronos: Learning the Language of Time Series" paper from the Amazon Web Services and Amazon Supply Chain Optimization Technologies. The MANATEE project is designed to fetch, compute, and plot historical data for financial securities, leveraging APIs from Alpaca and the power of Polars and Plotly for data manipulation and visualization. With features like calculating the rolling mean and Relative Strength Index (RSI), this tool also aids in analyzing the past performance of stocks and crypto assets.
18
-
19
- ![Plot](https://github.com/louisbrulenaudet/manatee/blob/main/scatter.png?raw=true)
20
-
21
- From source :
22
- > In this work, we take a step back and ask: what are the fundamental differences between a language model that predicts the next token, and a time series forecasting model that predicts the next values? Despite the apparent distinction — tokens from a finite dictionary versus values from an unbounded, usually continuous domain — both endeavors fundamentally aim to model the sequential structure of the data to predict future patterns. Shouldn't good language models “just work” on time series? This naive question prompts us to challenge the necessity of time-series-specific modifications, and answering it led us to develop Chronos, a language modeling framework minimally adapted for time series forecasting. Chronos tokenizes time series into discrete bins through simple scaling and quantization of real values. In this way, we can train off-the-shelf language models on this “language of time series,” with no changes to the model architecture. Remarkably, this straightforward approach proves to be effective and efficient, underscoring the potential for language model architectures to address a broad range of time series problems with minimal modifications.
23
- [...]
24
-
25
- ## Dependencies
26
- ### Libraries Used:
27
-
28
- 1. **`json`**: A built-in Python library for parsing JSON data. No need for installation.
29
-
30
- 2. **`datetime` & `time`**: Built-in Python libraries for handling date and time. Used here for defining time frames for data fetching. No installation required.
31
-
32
- 3. **`plotly`** (as `px`): Provides an easy-to-use interface to Plotly, which is used for creating interactive plots. Install via pip:
33
- ```shell
34
- pip3 install plotly
35
- ```
36
-
37
- 4. **`polars`** (as `pl`): A fast DataFrames library ideal for financial time-series data. Install using pip:
38
- ```shell
39
- pip3 install polars
40
- ```
41
-
42
- 5. **`alpaca-py`**: A Python library for Alpaca API. It provides access to historical stock/crypto data and trading operations. Install using pip:
43
- ```shell
44
- pip3 install alpaca-trade-api
45
- ```
46
-
47
- ### Installation Guide
48
-
49
- To install all the dependencies, you can use the following command:
50
-
51
- ```shell
52
- pip3 install plotly polars alpaca-py transformers gradio spaces
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  ```
54
 
55
- Note: Ensure you have Python installed on your system before proceeding with the installation of these libraries.
56
 
57
- ## Best Practices
58
- - **API Keys Management**: For security reasons, avoid hardcoding your API keys into the script. Consider using environment variables or a secure vault service.
59
 
60
- - **Data Privacy**: When handling financial data, it's crucial to comply with data protection regulations (such as GDPR, CCPA). Ensure you have the right to use and share the data fetched through this tool.
 
 
61
 
62
- - **Error Handling**: The script includes basic error handling, but for production use, consider implementing more comprehensive try-except blocks to handle network errors, API limit exceptions, and data inconsistencies.
 
63
 
64
- - **Plotting Considerations**: This tool uses Plotly for visualization, which is very versatile but can be resource-intensive for large datasets. For analyzing large datasets, consider creating plots with fewer data points or aggregating the data before plotting.
 
 
 
 
 
 
 
65
 
66
- - **Resource Management**: When dealing with large datasets or numerous API requests, monitor your system's and the API's usage to avoid overloading.
 
 
67
 
68
- - **Version Control**: Regularly update your dependencies. Financial APIs and data handling libraries evolve, and keeping them up to date can improve security, efficiency, and accessibility of new features.
69
 
70
- ## Citing this project
71
  If you use this code in your research, please use the following BibTeX entry.
72
 
73
  ```BibTeX
74
- @misc{louisbrulenaudet2023,
75
- author = {Louis Brulé Naudet},
76
- title = {MANATEE(lm) : Market Analysis based on language model architectures},
77
- howpublished = {\url{https://huggingface.co/spaces/louisbrulenaudet/manatee}},
78
- year = {2024}
79
  }
80
-
81
  ```
 
82
  ## Feedback
83
- If you have any feedback, please reach out at [louisbrulenaudet@icloud.com](mailto:louisbrulenaudet@icloud.com).
 
 
10
  license: apache-2.0
11
  short_description: Pearl-7B, an xtraordinary Space
12
  ---
13
+ <center><img src='https://i.imgur.com/0xFTuAX.png' width='450px'></center>
14
+
15
+ # Pearl-7B-0211-ties, an xtraordinary 7B model
16
+
17
+ **03-22-2024 - To date, louisbrulenaudet/Pearl-34B-ties is the "Best 🤝 base merges and moerges model of around 30B" on the Open LLM Leaderboard.**
18
+
19
+ Pearl-7B-0211-ties is a merge of the following models:
20
+ * [louisbrulenaudet/Pearl-7B-slerp](https://huggingface.co/louisbrulenaudet/Pearl-7B-slerp)
21
+ * [WizardLM/WizardMath-7B-V1.1](https://huggingface.co/WizardLM/WizardMath-7B-V1.1)
22
+ * [cognitivecomputations/WestLake-7B-v2-laser](https://huggingface.co/cognitivecomputations/WestLake-7B-v2-laser)
23
+ * [CultriX/NeuralTrix-7B-dpo](https://huggingface.co/CultriX/NeuralTrix-7B-dpo)
24
+
25
+ ## Evaluation
26
+
27
+ The evaluation was performed using the HuggingFace Open LLM Leaderboard.
28
+
29
+ | Model | Average | ARC | HellaSwag | MMLU | TruthfulQA | Winogrande | GSM8K | #Params (B) |
30
+ |--------------------------------------------------|---------|-------|-----------|-------|------------|------------|-------|--------------|
31
+ | **louisbrulenaudet/Pearl-34B-ties** | **75.48** | 70.99 | 84.83 | **76.63** | 70.32 | 82.64 | 67.48 | 34.39 |
32
+ | **louisbrulenaudet/Pearl-7B-0211-ties** | **75.11** | **71.42** | **88.86** | 63.91 | **71.46** | **84.37** | 70.66 | 7.24 |
33
+ | NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO | 73.35 | 71.08 | 87.29 | 72.17 | 54.83 | 83.11 | 71.65 | 46.7 |
34
+ | argilla/notus-8x7b-experiment | 73.18 | 70.99 | 87.73 | 71.33 | 65.79 | 81.61 | 61.64 | 46.7 |
35
+ | **louisbrulenaudet/Pearl-7B-slerp** | 72.75 | 68.00 | 87.16 | 64.04 | 62.35 | 81.29 | **73.62** | 7.24 |
36
+ | mistralai/Mixtral-8x7B-Instruct-v0.1 | 72.7 | 70.14 | 87.55 | 71.4 | 64.98 | 81.06 | 61.11 | 46.7 |
37
+ | microsoft/Orca-2-13b | 61.98 | 60.92 | 79.85 | 60.3 | 56.42 | 76.56 | 37.83 | 13 |
38
+ | microsoft/phi-2 | 61.33 | 61.09 | 75.11 | 58.11 | 44.47 | 74.35 | 54.81 | 2.78 |
39
+
40
+ ### Ties merging
41
+
42
+ TIES-Merging is a method designed to facilitate the efficient merging of multiple task-specific models into a consolidated multitask model. It addresses two primary challenges encountered in the process of model merging with a focus on maintaining objectivity.
43
+
44
+ One key challenge tackled by TIES-Merging involves addressing redundancy in model parameters. This is achieved by identifying and eliminating redundant parameters within task-specific models, emphasizing the changes made during fine-tuning and selectively retaining the top-k% most significant changes while discarding the rest.
45
+
46
+ Another challenge pertains to conflicts arising from disagreements between parameter signs across different models. TIES-Merging resolves these conflicts by creating a unified sign vector representing the most dominant direction of change across all models.
47
+
48
+ The TIES-Merging process consists of three steps:
49
+
50
+ - Trim: Reduces redundancy in task-specific models by retaining a fraction of the most significant parameters (density parameter) and resetting the remaining parameters to zero.
51
+ - Elect Sign: Resolves sign conflicts across different models by creating a unified sign vector based on the most dominant direction (positive or negative) in terms of cumulative magnitude.
52
+ - Disjoint Merge: Averages parameter values aligned with the unified sign vector, excluding zero values.
53
+
54
+ ## Configuration
55
+
56
+ ```yaml
57
+ models:
58
+ - model: OpenPipe/mistral-ft-optimized-1227
59
+ - model: louisbrulenaudet/Pearl-7B-slerp
60
+ parameters:
61
+ density: 0.6
62
+ weight: 0.3
63
+ - model: WizardLM/WizardMath-7B-V1.1
64
+ parameters:
65
+ density: 0.55
66
+ weight: 0.2
67
+ - model: cognitivecomputations/WestLake-7B-v2-laser
68
+ parameters:
69
+ density: 0.55
70
+ weight: 0.25
71
+ - model: CultriX/NeuralTrix-7B-dpo
72
+ parameters:
73
+ density: 0.6
74
+ weight: 0.25
75
+ merge_method: ties
76
+ base_model: OpenPipe/mistral-ft-optimized-1227
77
+ parameters:
78
+ normalize: true
79
+ int8_mask: true
80
+ dtype: float16
81
  ```
82
 
83
+ ## Usage
84
 
85
+ ```python
86
+ !pip install -qU transformers accelerate
87
 
88
+ from transformers import AutoTokenizer
89
+ import transformers
90
+ import torch
91
 
92
+ model = "louisbrulenaudet/Pearl-7B-0211-ties"
93
+ messages = [{"role": "user", "content": "What is a large language model?"}]
94
 
95
+ tokenizer = AutoTokenizer.from_pretrained(model)
96
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
97
+ pipeline = transformers.pipeline(
98
+ "text-generation",
99
+ model=model,
100
+ torch_dtype=torch.float16,
101
+ device_map="auto",
102
+ )
103
 
104
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
105
+ print(outputs[0]["generated_text"])
106
+ ```
107
 
108
+ ## Citing & Authors
109
 
 
110
  If you use this code in your research, please use the following BibTeX entry.
111
 
112
  ```BibTeX
113
+ @misc{louisbrulenaudet2024,
114
+ author = {Louis Brulé Naudet},
115
+ title = {Pearl-7B-0211-ties, an xtraordinary 7B model},
116
+ year = {2024}
117
+ howpublished = {\url{https://huggingface.co/louisbrulenaudet/Pearl-7B-0211-ties}},
118
  }
 
119
  ```
120
+
121
  ## Feedback
122
+
123
+ If you have any feedback, please reach out at [louisbrulenaudet@icloud.com](mailto:louisbrulenaudet@icloud.com).