Update README.md
Browse files
README.md
CHANGED
@@ -10,3 +10,34 @@ license: mit
|
|
10 |
|
11 |
<!-- Provide a quick summary of what the model is/does. -->
|
12 |
This is an embedding model derived from [AutonLab/MOMENT-1-large](https://huggingface.co/AutonLab/MOMENT-1-large)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
<!-- Provide a quick summary of what the model is/does. -->
|
12 |
This is an embedding model derived from [AutonLab/MOMENT-1-large](https://huggingface.co/AutonLab/MOMENT-1-large)
|
13 |
+
|
14 |
+
## How to use
|
15 |
+
```Python
|
16 |
+
from transformers import AutoConfig, AutoModel, AutoFeatureExtractor
|
17 |
+
|
18 |
+
model_name = "HachiML/MOMENT-1-large-embedding-v0.1"
|
19 |
+
|
20 |
+
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
|
21 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name, trust_remote_code=True)
|
22 |
+
```
|
23 |
+
|
24 |
+
```Python
|
25 |
+
import torch
|
26 |
+
|
27 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
28 |
+
print(device)
|
29 |
+
|
30 |
+
model.to(device)
|
31 |
+
```
|
32 |
+
|
33 |
+
```Python
|
34 |
+
hist_ndaq = pd.DataFrame("nasdaq_price_history.csv")
|
35 |
+
input_data = hist_ndaq[["Open", "High", "Low", "Close", "Volume"]].iloc[:512]
|
36 |
+
|
37 |
+
inputs = feature_extractor(input_data, return_tensors="pt")
|
38 |
+
# inputs = feature_extractor([input_data], return_tensors="pt") # You can also pass multiple data in a list.
|
39 |
+
|
40 |
+
inputs = inputs.to(device)
|
41 |
+
outputs = model(**inputs)
|
42 |
+
print(outputs.embeddings)
|
43 |
+
```
|