Add new SentenceTransformer model
Browse files- README.md +280 -411
- config.json +1 -1
- config_sentence_transformers.json +4 -4
README.md
CHANGED
@@ -12,68 +12,120 @@ tags:
|
|
12 |
- loss:MultipleNegativesRankingLoss
|
13 |
base_model: Snowflake/snowflake-arctic-embed-m-v1.5
|
14 |
widget:
|
15 |
-
- source_sentence:
|
16 |
sentences:
|
17 |
-
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
|
23 |
-
|
24 |
-
it will default to the current working directory, but usually, it''s better to
|
25 |
-
not have to rely on this mechanism and initialize zenml at the root.
|
26 |
|
27 |
|
28 |
-
|
29 |
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
- 'ZenML - Bridging the gap between ML & Ops
|
78 |
|
79 |
|
@@ -87,104 +139,104 @@ widget:
|
|
87 |
|
88 |
|
89 |
Powered by GitBook'
|
90 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
sentences:
|
92 |
-
- '
|
93 |
-
|
94 |
-
|
95 |
-
How to collect and visualize statistics to track changes in your pipelines'' data
|
96 |
-
with whylogs/WhyLabs profiling.
|
97 |
-
|
98 |
-
|
99 |
-
The whylogs/WhyLabs Data Validator flavor provided with the ZenML integration
|
100 |
-
uses whylogs and WhyLabs to generate and track data profiles, highly accurate
|
101 |
-
descriptive representations of your data. The profiles can be used to implement
|
102 |
-
automated corrective actions in your pipelines, or to render interactive representations
|
103 |
-
for further visual interpretation, evaluation and documentation.
|
104 |
-
|
105 |
-
|
106 |
-
When would you want to use it?
|
107 |
-
|
108 |
|
109 |
-
Whylogs is an open-source library that analyzes your data and creates statistical
|
110 |
-
summaries called whylogs profiles. Whylogs profiles can be processed in your pipelines
|
111 |
-
and visualized locally or uploaded to the WhyLabs platform, where more in depth
|
112 |
-
analysis can be carried out. Even though whylogs also supports other data types,
|
113 |
-
the ZenML whylogs integration currently only works with tabular data in pandas.DataFrame
|
114 |
-
format.
|
115 |
|
|
|
|
|
|
|
116 |
|
117 |
-
You should use the whylogs/WhyLabs Data Validator when you need the following
|
118 |
-
data validation features that are possible with whylogs and WhyLabs:
|
119 |
|
|
|
120 |
|
121 |
-
Data Quality: validate data quality in model inputs or in a data pipeline
|
122 |
|
|
|
123 |
|
124 |
-
Data Drift: detect data drift in model input features
|
125 |
-
|
126 |
-
|
127 |
-
Model Drift: Detect training-serving skew, concept drift, and model performance
|
128 |
-
degradation
|
129 |
-
|
130 |
-
|
131 |
-
You should consider one of the other Data Validator flavors if you need a different
|
132 |
-
set of data validation features.
|
133 |
-
|
134 |
-
|
135 |
-
How do you deploy it?
|
136 |
-
|
137 |
-
|
138 |
-
The whylogs Data Validator flavor is included in the whylogs ZenML integration,
|
139 |
-
you need to install it on your local machine to be able to register a whylogs
|
140 |
-
Data Validator and add it to your stack:
|
141 |
-
|
142 |
-
|
143 |
-
zenml integration install whylogs -y
|
144 |
-
|
145 |
-
|
146 |
-
If you don''t need to connect to the WhyLabs platform to upload and store the
|
147 |
-
generated whylogs data profiles, the Data Validator stack component does not require
|
148 |
-
any configuration parameters. Adding it to a stack is as simple as running e.g.:'
|
149 |
-
- 'ZenML - Bridging the gap between ML & Ops
|
150 |
|
|
|
151 |
|
152 |
-
Legacy Docs
|
153 |
|
|
|
154 |
|
155 |
-
Bleeding EdgeLegacy Docs0.67.0
|
156 |
|
|
|
|
|
157 |
|
158 |
-
🧙♂️Find older version our docs
|
159 |
|
|
|
160 |
|
161 |
-
|
162 |
-
- 'ZenML - Bridging the gap between ML & Ops
|
163 |
|
164 |
|
165 |
-
|
|
|
166 |
|
167 |
|
168 |
-
|
|
|
169 |
|
170 |
|
171 |
-
|
172 |
|
173 |
|
174 |
-
|
175 |
-
-
|
176 |
-
what precautions should I take when installing on a Mac with Apple Silicon?
|
177 |
-
sentences:
|
178 |
-
- 'Finetuning LLMs with ZenML
|
179 |
|
180 |
|
181 |
-
|
182 |
|
183 |
|
184 |
-
|
185 |
|
186 |
|
187 |
-
Last updated
|
188 |
- '🧙Installation
|
189 |
|
190 |
|
@@ -270,188 +322,70 @@ widget:
|
|
270 |
|
271 |
|
272 |
Running with Docker'
|
273 |
-
|
274 |
-
|
275 |
-
\ generate data profiles. You may optionally enable whylabs logging to automatically\
|
276 |
-
\ upload the returned whylogs profile to WhyLabs, e.g.:\n\nimport pandas as pd\n\
|
277 |
-
from whylogs.core import DatasetProfileView\nfrom zenml.integrations.whylogs.data_validators.whylogs_data_validator\
|
278 |
-
\ import (\n WhylogsDataValidator,\n)\nfrom zenml.integrations.whylogs.flavors.whylogs_data_validator_flavor\
|
279 |
-
\ import (\n WhylogsDataValidatorSettings,\n)\nfrom zenml import step\n\nwhylogs_settings\
|
280 |
-
\ = WhylogsDataValidatorSettings(\n enable_whylabs=True, dataset_id=\"<WHYLABS_DATASET_ID>\"\
|
281 |
-
\n)\n\n@step(\n settings={\n \"data_validator\": whylogs_settings\n\
|
282 |
-
\ }\n)\ndef data_profiler(\n dataset: pd.DataFrame,\n) -> DatasetProfileView:\n\
|
283 |
-
\ \"\"\"Custom data profiler step with whylogs\n\nArgs:\n dataset: a\
|
284 |
-
\ Pandas DataFrame\n\nReturns:\n Whylogs profile generated for the data\n\
|
285 |
-
\ \"\"\"\n\n# validation pre-processing (e.g. dataset preparation) can take\
|
286 |
-
\ place here\n\ndata_validator = WhylogsDataValidator.get_active_data_validator()\n\
|
287 |
-
\ profile = data_validator.data_profiling(\n dataset,\n )\n #\
|
288 |
-
\ optionally upload the profile to WhyLabs, if WhyLabs credentials are configured\n\
|
289 |
-
\ data_validator.upload_profile_view(profile)\n\n# validation post-processing\
|
290 |
-
\ (e.g. interpret results, take actions) can happen here\n\nreturn profile\n\n\
|
291 |
-
Have a look at the complete list of methods and parameters available in the WhylogsDataValidator\
|
292 |
-
\ API in the SDK docs.\n\nCall whylogs directly\n\nYou can use the whylogs library\
|
293 |
-
\ directly in your custom pipeline steps, and only leverage ZenML's capability\
|
294 |
-
\ of serializing, versioning and storing the DatasetProfileView objects in its\
|
295 |
-
\ Artifact Store. You may optionally enable whylabs logging to automatically upload\
|
296 |
-
\ the returned whylogs profile to WhyLabs, e.g.:"
|
297 |
-
- source_sentence: How can I finetune embeddings using Sentence Transformers as described
|
298 |
-
in the ZenML documentation?
|
299 |
sentences:
|
300 |
-
- '
|
301 |
|
302 |
|
303 |
-
|
304 |
|
305 |
|
306 |
-
|
307 |
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
\
|
315 |
-
\
|
316 |
-
\
|
317 |
-
\
|
318 |
-
|
319 |
-
\
|
320 |
-
\
|
321 |
-
\
|
322 |
-
\
|
323 |
-
\
|
324 |
-
\
|
325 |
-
\
|
326 |
-
|
327 |
-
\
|
328 |
-
\
|
329 |
-
\
|
330 |
-
\
|
331 |
-
\
|
332 |
-
\
|
333 |
-
|
334 |
-
\
|
335 |
-
\
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
\
|
352 |
-
|
353 |
-
\
|
354 |
-
\
|
355 |
-
\
|
356 |
-
|
357 |
-
\
|
358 |
-
\
|
359 |
-
\
|
360 |
-
\
|
361 |
-
\ configuration.\n\nWhen to use it\n\nYou should use the Spark step operator:\n\
|
362 |
-
\nwhen you are dealing with large amounts of data.\n\nwhen you are designing a\
|
363 |
-
\ step that can benefit from distributed computing paradigms in terms of time\
|
364 |
-
\ and resources.\n\nHow to deploy it\n\nTo use the KubernetesSparkStepOperator\
|
365 |
-
\ you will need to setup a few things first:\n\nRemote ZenML server: See the deployment\
|
366 |
-
\ guide for more information.\n\nKubernetes cluster: There are many ways to deploy\
|
367 |
-
\ a Kubernetes cluster using different cloud providers or on your custom infrastructure.\
|
368 |
-
\ For AWS, you can follow the Spark EKS Setup Guide below.\n\nSpark EKS Setup\
|
369 |
-
\ Guide\n\nThe following guide will walk you through how to spin up and configure\
|
370 |
-
\ a Amazon Elastic Kubernetes Service with Spark on it:\n\nEKS Kubernetes Cluster\n\
|
371 |
-
\nFollow this guide to create an Amazon EKS cluster role.\n\nFollow this guide\
|
372 |
-
\ to create an Amazon EC2 node role.\n\nGo to the IAM website, and select Roles\
|
373 |
-
\ to edit both roles.\n\nAttach the AmazonRDSFullAccess and AmazonS3FullAccess\
|
374 |
-
\ policies to both roles.\n\nGo to the EKS website.\n\nMake sure the correct region\
|
375 |
-
\ is selected on the top right."
|
376 |
-
- "\U0001F5C4️Handle Data/Artifacts\n\nStep outputs in ZenML are stored in the artifact\
|
377 |
-
\ store. This enables caching, lineage and auditability. Using type annotations\
|
378 |
-
\ helps with transparency, passing data between steps, and serializing/des\n\n\
|
379 |
-
For best results, use type annotations for your outputs. This is good coding practice\
|
380 |
-
\ for transparency, helps ZenML handle passing data between steps, and also enables\
|
381 |
-
\ ZenML to serialize and deserialize (referred to as 'materialize' in ZenML) the\
|
382 |
-
\ data.\n\n@step\ndef load_data(parameter: int) -> Dict[str, Any]:\n\n# do something\
|
383 |
-
\ with the parameter here\n\ntraining_data = [[1, 2], [3, 4], [5, 6]]\n labels\
|
384 |
-
\ = [0, 1, 0]\n return {'features': training_data, 'labels': labels}\n\n@step\n\
|
385 |
-
def train_model(data: Dict[str, Any]) -> None:\n total_features = sum(map(sum,\
|
386 |
-
\ data['features']))\n total_labels = sum(data['labels'])\n \n # Train\
|
387 |
-
\ some model here\n \n print(f\"Trained model using {len(data['features'])}\
|
388 |
-
\ data points. \"\n f\"Feature sum is {total_features}, label sum is\
|
389 |
-
\ {total_labels}\")\n\n@pipeline \ndef simple_ml_pipeline(parameter: int):\n\
|
390 |
-
\ dataset = load_data(parameter=parameter) # Get the output \n train_model(dataset)\
|
391 |
-
\ # Pipe the previous step output into the downstream step\n\nIn this code, we\
|
392 |
-
\ define two steps: load_data and train_model. The load_data step takes an integer\
|
393 |
-
\ parameter and returns a dictionary containing training data and labels. The\
|
394 |
-
\ train_model step receives the dictionary from load_data, extracts the features\
|
395 |
-
\ and labels, and trains a model (not shown here).\n\nFinally, we define a pipeline\
|
396 |
-
\ simple_ml_pipeline that chains the load_data and train_model steps together.\
|
397 |
-
\ The output from load_data is passed as input to train_model, demonstrating how\
|
398 |
-
\ data flows between steps in a ZenML pipeline.\n\nPreviousDisable colorful loggingNextHow\
|
399 |
-
\ ZenML stores data\n\nLast updated 4 months ago"
|
400 |
-
- ' your GCP Image Builder to the GCP cloud platform.To set up the GCP Image Builder
|
401 |
-
to authenticate to GCP and access the GCP Cloud Build services, it is recommended
|
402 |
-
to leverage the many features provided by the GCP Service Connector such as auto-configuration,
|
403 |
-
best security practices regarding long-lived credentials and reusing the same
|
404 |
-
credentials across multiple stack components.
|
405 |
-
|
406 |
-
|
407 |
-
If you don''t already have a GCP Service Connector configured in your ZenML deployment,
|
408 |
-
you can register one using the interactive CLI command. You also have the option
|
409 |
-
to configure a GCP Service Connector that can be used to access more than just
|
410 |
-
the GCP Cloud Build service:
|
411 |
-
|
412 |
-
|
413 |
-
zenml service-connector register --type gcp -i
|
414 |
-
|
415 |
-
|
416 |
-
A non-interactive CLI example that leverages the Google Cloud CLI configuration
|
417 |
-
on your local machine to auto-configure a GCP Service Connector for the GCP Cloud
|
418 |
-
Build service:
|
419 |
-
|
420 |
-
|
421 |
-
zenml service-connector register <CONNECTOR_NAME> --type gcp --resource-type gcp-generic
|
422 |
-
--resource-name <GCS_BUCKET_NAME> --auto-configure
|
423 |
-
|
424 |
-
|
425 |
-
Example Command Output
|
426 |
-
|
427 |
-
|
428 |
-
$ zenml service-connector register gcp-generic --type gcp --resource-type gcp-generic
|
429 |
-
--auto-configure
|
430 |
-
|
431 |
-
Successfully registered service connector `gcp-generic` with access to the following
|
432 |
-
resources:
|
433 |
-
|
434 |
-
┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓
|
435 |
-
|
436 |
-
┃ RESOURCE TYPE │ RESOURCE NAMES ┃
|
437 |
-
|
438 |
-
┠────────────────┼────────────────┨
|
439 |
-
|
440 |
-
┃ 🔵 gcp-generic │ zenml-core ┃
|
441 |
-
|
442 |
-
┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛
|
443 |
-
|
444 |
-
|
445 |
-
Note: Please remember to grant the entity associated with your GCP credentials
|
446 |
-
permissions to access the Cloud Build API and to run Cloud Builder jobs (e.g.
|
447 |
-
the Cloud Build Editor IAM role). The GCP Service Connector supports many different
|
448 |
-
authentication methods with different levels of security and convenience. You
|
449 |
-
should pick the one that best fits your use case.
|
450 |
-
|
451 |
-
|
452 |
-
If you already have one or more GCP Service Connectors configured in your ZenML
|
453 |
-
deployment, you can check which of them can be used to access generic GCP resources
|
454 |
-
like the GCP Image Builder required for your GCP Image Builder by running e.g.:'
|
455 |
pipeline_tag: sentence-similarity
|
456 |
library_name: sentence-transformers
|
457 |
metrics:
|
@@ -536,7 +470,7 @@ model-index:
|
|
536 |
value: 0.75
|
537 |
name: Cosine Accuracy@1
|
538 |
- type: cosine_accuracy@3
|
539 |
-
value:
|
540 |
name: Cosine Accuracy@3
|
541 |
- type: cosine_accuracy@5
|
542 |
value: 1.0
|
@@ -548,7 +482,7 @@ model-index:
|
|
548 |
value: 0.75
|
549 |
name: Cosine Precision@1
|
550 |
- type: cosine_precision@3
|
551 |
-
value: 0.
|
552 |
name: Cosine Precision@3
|
553 |
- type: cosine_precision@5
|
554 |
value: 0.2
|
@@ -560,7 +494,7 @@ model-index:
|
|
560 |
value: 0.75
|
561 |
name: Cosine Recall@1
|
562 |
- type: cosine_recall@3
|
563 |
-
value:
|
564 |
name: Cosine Recall@3
|
565 |
- type: cosine_recall@5
|
566 |
value: 1.0
|
@@ -569,13 +503,13 @@ model-index:
|
|
569 |
value: 1.0
|
570 |
name: Cosine Recall@10
|
571 |
- type: cosine_ndcg@10
|
572 |
-
value: 0.
|
573 |
name: Cosine Ndcg@10
|
574 |
- type: cosine_mrr@10
|
575 |
-
value: 0.
|
576 |
name: Cosine Mrr@10
|
577 |
- type: cosine_map@100
|
578 |
-
value: 0.
|
579 |
name: Cosine Map@100
|
580 |
- task:
|
581 |
type: information-retrieval
|
@@ -691,9 +625,9 @@ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [S
|
|
691 |
|
692 |
### Model Description
|
693 |
- **Model Type:** Sentence Transformer
|
694 |
-
- **Base model:** [Snowflake/snowflake-arctic-embed-m-v1.5](https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v1.5) <!-- at revision
|
695 |
- **Maximum Sequence Length:** 512 tokens
|
696 |
-
- **Output Dimensionality:** 768
|
697 |
- **Similarity Function:** Cosine Similarity
|
698 |
- **Training Dataset:**
|
699 |
- json
|
@@ -734,9 +668,9 @@ from sentence_transformers import SentenceTransformer
|
|
734 |
model = SentenceTransformer("zenml/finetuned-snowflake-arctic-embed-m-v1.5")
|
735 |
# Run inference
|
736 |
sentences = [
|
737 |
-
'How does
|
738 |
-
'
|
739 |
-
"
|
740 |
]
|
741 |
embeddings = model.encode(sentences)
|
742 |
print(embeddings.shape)
|
@@ -777,92 +711,27 @@ You can finetune this model on your own dataset.
|
|
777 |
### Metrics
|
778 |
|
779 |
#### Information Retrieval
|
780 |
-
* Dataset: `dim_384`
|
781 |
-
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
782 |
-
|
783 |
-
| Metric | Value |
|
784 |
-
|:--------------------|:-----------|
|
785 |
-
| cosine_accuracy@1 | 0.75 |
|
786 |
-
| cosine_accuracy@3 | 1.0 |
|
787 |
-
| cosine_accuracy@5 | 1.0 |
|
788 |
-
| cosine_accuracy@10 | 1.0 |
|
789 |
-
| cosine_precision@1 | 0.75 |
|
790 |
-
| cosine_precision@3 | 0.3333 |
|
791 |
-
| cosine_precision@5 | 0.2 |
|
792 |
-
| cosine_precision@10 | 0.1 |
|
793 |
-
| cosine_recall@1 | 0.75 |
|
794 |
-
| cosine_recall@3 | 1.0 |
|
795 |
-
| cosine_recall@5 | 1.0 |
|
796 |
-
| cosine_recall@10 | 1.0 |
|
797 |
-
| cosine_ndcg@10 | 0.875 |
|
798 |
-
| cosine_mrr@10 | 0.8333 |
|
799 |
-
| **cosine_map@100** | **0.8333** |
|
800 |
-
|
801 |
-
#### Information Retrieval
|
802 |
-
* Dataset: `dim_256`
|
803 |
-
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
804 |
|
805 |
-
|
806 |
-
|:--------------------|:-----------|
|
807 |
-
| cosine_accuracy@1 | 0.75 |
|
808 |
-
| cosine_accuracy@3 | 1.0 |
|
809 |
-
| cosine_accuracy@5 | 1.0 |
|
810 |
-
| cosine_accuracy@10 | 1.0 |
|
811 |
-
| cosine_precision@1 | 0.75 |
|
812 |
-
| cosine_precision@3 | 0.3333 |
|
813 |
-
| cosine_precision@5 | 0.2 |
|
814 |
-
| cosine_precision@10 | 0.1 |
|
815 |
-
| cosine_recall@1 | 0.75 |
|
816 |
-
| cosine_recall@3 | 1.0 |
|
817 |
-
| cosine_recall@5 | 1.0 |
|
818 |
-
| cosine_recall@10 | 1.0 |
|
819 |
-
| cosine_ndcg@10 | 0.875 |
|
820 |
-
| cosine_mrr@10 | 0.8333 |
|
821 |
-
| **cosine_map@100** | **0.8333** |
|
822 |
-
|
823 |
-
#### Information Retrieval
|
824 |
-
* Dataset: `dim_128`
|
825 |
-
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
826 |
-
|
827 |
-
| Metric | Value |
|
828 |
-
|:--------------------|:-----------|
|
829 |
-
| cosine_accuracy@1 | 0.75 |
|
830 |
-
| cosine_accuracy@3 | 0.75 |
|
831 |
-
| cosine_accuracy@5 | 1.0 |
|
832 |
-
| cosine_accuracy@10 | 1.0 |
|
833 |
-
| cosine_precision@1 | 0.75 |
|
834 |
-
| cosine_precision@3 | 0.25 |
|
835 |
-
| cosine_precision@5 | 0.2 |
|
836 |
-
| cosine_precision@10 | 0.1 |
|
837 |
-
| cosine_recall@1 | 0.75 |
|
838 |
-
| cosine_recall@3 | 0.75 |
|
839 |
-
| cosine_recall@5 | 1.0 |
|
840 |
-
| cosine_recall@10 | 1.0 |
|
841 |
-
| cosine_ndcg@10 | 0.8577 |
|
842 |
-
| cosine_mrr@10 | 0.8125 |
|
843 |
-
| **cosine_map@100** | **0.8125** |
|
844 |
-
|
845 |
-
#### Information Retrieval
|
846 |
-
* Dataset: `dim_64`
|
847 |
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
848 |
|
849 |
-
| Metric |
|
850 |
-
|
851 |
-
| cosine_accuracy@1 | 0.75 |
|
852 |
-
| cosine_accuracy@3 | 1.0
|
853 |
-
| cosine_accuracy@5 | 1.0 |
|
854 |
-
| cosine_accuracy@10 | 1.0 |
|
855 |
-
| cosine_precision@1 | 0.75 |
|
856 |
-
| cosine_precision@3 | 0.3333
|
857 |
-
| cosine_precision@5 | 0.2 |
|
858 |
-
| cosine_precision@10 | 0.1 |
|
859 |
-
| cosine_recall@1 | 0.75 |
|
860 |
-
| cosine_recall@3 | 1.0
|
861 |
-
| cosine_recall@5 | 1.0 |
|
862 |
-
| cosine_recall@10 | 1.0 |
|
863 |
-
| cosine_ndcg@10
|
864 |
-
| cosine_mrr@10 | 0.8333 |
|
865 |
-
|
|
866 |
|
867 |
<!--
|
868 |
## Bias, Risks and Limitations
|
@@ -889,13 +758,13 @@ You can finetune this model on your own dataset.
|
|
889 |
| | positive | anchor |
|
890 |
|:--------|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
|
891 |
| type | string | string |
|
892 |
-
| details | <ul><li>min: 13 tokens</li><li>mean: 23.
|
893 |
* Samples:
|
894 |
-
| positive
|
895 |
-
|
896 |
-
| <code>
|
897 |
-
| <code>How do
|
898 |
-
| <code>How do
|
899 |
* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
|
900 |
```json
|
901 |
{
|
@@ -989,7 +858,7 @@ You can finetune this model on your own dataset.
|
|
989 |
- `dataloader_num_workers`: 0
|
990 |
- `dataloader_prefetch_factor`: None
|
991 |
- `past_index`: -1
|
992 |
-
- `disable_tqdm`:
|
993 |
- `remove_unused_columns`: True
|
994 |
- `label_names`: None
|
995 |
- `load_best_model_at_end`: True
|
@@ -1043,30 +912,30 @@ You can finetune this model on your own dataset.
|
|
1043 |
- `optim_target_modules`: None
|
1044 |
- `batch_eval_metrics`: False
|
1045 |
- `eval_on_start`: False
|
1046 |
-
- `use_liger_kernel`: False
|
1047 |
- `eval_use_gather_object`: False
|
|
|
1048 |
- `batch_sampler`: no_duplicates
|
1049 |
- `multi_dataset_batch_sampler`: proportional
|
1050 |
|
1051 |
</details>
|
1052 |
|
1053 |
### Training Logs
|
1054 |
-
| Epoch | Step |
|
1055 |
|:-------:|:-----:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|
|
1056 |
-
| **1.0** | **1** | **0.
|
1057 |
-
| 2.0 | 3 | 0.
|
1058 |
-
| 3.0 | 4 | 0.
|
1059 |
|
1060 |
* The bold row denotes the saved checkpoint.
|
1061 |
|
1062 |
### Framework Versions
|
1063 |
-
- Python: 3.11.
|
1064 |
-
- Sentence Transformers: 3.
|
1065 |
-
- Transformers: 4.
|
1066 |
-
- PyTorch: 2.5.
|
1067 |
-
- Accelerate: 1.
|
1068 |
-
- Datasets: 3.0
|
1069 |
-
- Tokenizers: 0.
|
1070 |
|
1071 |
## Citation
|
1072 |
|
|
|
12 |
- loss:MultipleNegativesRankingLoss
|
13 |
base_model: Snowflake/snowflake-arctic-embed-m-v1.5
|
14 |
widget:
|
15 |
+
- source_sentence: How can I connect a GCP Image Builder to resources using ZenML?
|
16 |
sentences:
|
17 |
+
- "_run.steps[step_name]\n whylogs_step.visualize()if __name__ == \"__main__\"\
|
18 |
+
:\n visualize_statistics(\"data_loader\")\n visualize_statistics(\"train_data_profiler\"\
|
19 |
+
, \"test_data_profiler\")\n\nPreviousEvidentlyNextDevelop a custom data validator\n\
|
20 |
+
\nLast updated 1 month ago"
|
21 |
+
- 'Implement a custom integration
|
22 |
|
23 |
|
24 |
+
Creating an external integration and contributing to ZenML
|
|
|
|
|
25 |
|
26 |
|
27 |
+
PreviousContribute to ZenMLNextOverview
|
28 |
|
29 |
|
30 |
+
Last updated 4 months ago'
|
31 |
+
- "--connector <CONNECTOR_ID>\n\nExample Command Output$ zenml image-builder connect\
|
32 |
+
\ gcp-image-builder --connector gcp-generic\nSuccessfully connected image builder\
|
33 |
+
\ `gcp-image-builder` to the following resources:\n┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓\n\
|
34 |
+
┃ CONNECTOR ID │ CONNECTOR NAME │ CONNECTOR TYPE │ RESOURCE\
|
35 |
+
\ TYPE │ RESOURCE NAMES ┃\n┠──────────────────────────────────────┼────────────────┼────────────────┼────────────────┼────────────────┨\n\
|
36 |
+
┃ bfdb657d-d808-47e7-9974-9ba6e4919d83 │ gcp-generic │ \U0001F535 gcp \
|
37 |
+
\ │ \U0001F535 gcp-generic │ zenml-core ┃\n┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n\
|
38 |
+
\nAs a final step, you can use the GCP Image Builder in a ZenML Stack:\n\n# Register\
|
39 |
+
\ and set a stack with the new image builder\nzenml stack register <STACK_NAME>\
|
40 |
+
\ -i <IMAGE_BUILDER_NAME> ... --set\n\nWhen you register the GCP Image Builder,\
|
41 |
+
\ you can generate a GCP Service Account Key, save it to a local file and then\
|
42 |
+
\ reference it in the Image Builder configuration.\n\nThis method has the advantage\
|
43 |
+
\ that you don't need to install and configure the GCP CLI on your host, but it's\
|
44 |
+
\ still not as secure as using a GCP Service Connector and the stack component\
|
45 |
+
\ configuration is not portable to other hosts.\n\nFor this method, you need to\
|
46 |
+
\ create a user-managed GCP service account, and grant it privileges to access\
|
47 |
+
\ the Cloud Build API and to run Cloud Builder jobs (e.g. the Cloud Build Editor\
|
48 |
+
\ IAM role.\n\nWith the service account key downloaded to a local file, you can\
|
49 |
+
\ register the GCP Image Builder as follows:\n\nzenml image-builder register <IMAGE_BUILDER_NAME>\
|
50 |
+
\ \\\n --flavor=gcp \\\n --project=<GCP_PROJECT_ID> \\\n --service_account_path=<PATH_TO_SERVICE_ACCOUNT_KEY>\
|
51 |
+
\ \\\n --cloud_builder_image=<BUILDER_IMAGE_NAME> \\\n --network=<DOCKER_NETWORK>\
|
52 |
+
\ \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS>"
|
53 |
+
- source_sentence: How do I register and activate a ZenML stack with a new GCP Image
|
54 |
+
Builder while ensuring proper authentication?
|
55 |
+
sentences:
|
56 |
+
- "oad the returned whylogs profile to WhyLabs, e.g.:import pandas as pd\nfrom whylogs.core\
|
57 |
+
\ import DatasetProfileView\nimport whylogs as why\nfrom zenml import step\nfrom\
|
58 |
+
\ zenml.integrations.whylogs.flavors.whylogs_data_validator_flavor import (\n\
|
59 |
+
\ WhylogsDataValidatorSettings,\n)\n\nwhylogs_settings = WhylogsDataValidatorSettings(\n\
|
60 |
+
\ enable_whylabs=True, dataset_id=\"<WHYLABS_DATASET_ID>\"\n)\n\n@step(\n \
|
61 |
+
\ settings={\n \"data_validator\": whylogs_settings\n }\n)\ndef data_profiler(\n\
|
62 |
+
\ dataset: pd.DataFrame,\n) -> DatasetProfileView:\n \"\"\"Custom data\
|
63 |
+
\ profiler step with whylogs\n\nArgs:\n dataset: a Pandas DataFrame\n\n\
|
64 |
+
Returns:\n Whylogs Profile generated for the dataset\n \"\"\"\n\n# validation\
|
65 |
+
\ pre-processing (e.g. dataset preparation) can take place here\n\nresults = why.log(dataset)\n\
|
66 |
+
\ profile = results.profile()\n\n# validation post-processing (e.g. interpret\
|
67 |
+
\ results, take actions) can happen here\n\nreturn profile.view()\n\nVisualizing\
|
68 |
+
\ whylogs Profiles\n\nYou can view visualizations of the whylogs profiles generated\
|
69 |
+
\ by your pipeline steps directly in the ZenML dashboard by clicking on the respective\
|
70 |
+
\ artifact in the pipeline run DAG.\n\nAlternatively, if you are running inside\
|
71 |
+
\ a Jupyter notebook, you can load and render the whylogs profiles using the artifact.visualize()\
|
72 |
+
\ method, e.g.:\n\nfrom zenml.client import Client\n\ndef visualize_statistics(\n\
|
73 |
+
\ step_name: str, reference_step_name: Optional[str] = None\n) -> None:\n \
|
74 |
+
\ \"\"\"Helper function to visualize whylogs statistics from step artifacts.\n\
|
75 |
+
\nArgs:\n step_name: step that generated and returned a whylogs profile\n\
|
76 |
+
\ reference_step_name: an optional second step that generated a whylogs\n\
|
77 |
+
\ profile to use for data drift visualization where two whylogs\n \
|
78 |
+
\ profiles are required.\n \"\"\"\n pipe = Client().get_pipeline(pipeline=\"\
|
79 |
+
data_profiling_pipeline\")\n whylogs_step = pipe.last_run.steps[step_name]\n\
|
80 |
+
\ whylogs_step.visualize()"
|
81 |
+
- "ogsDataValidatorSettings,\n)\nfrom zenml import step@step(\n settings={\n\
|
82 |
+
\ \"data_validator\": WhylogsDataValidatorSettings(\n enable_whylabs=True,\
|
83 |
+
\ dataset_id=\"model-1\"\n )\n }\n)\ndef data_loader() -> Tuple[\n \
|
84 |
+
\ Annotated[pd.DataFrame, \"data\"],\n Annotated[DatasetProfileView, \"profile\"\
|
85 |
+
]\n]:\n \"\"\"Load the diabetes dataset.\"\"\"\n X, y = datasets.load_diabetes(return_X_y=True,\
|
86 |
+
\ as_frame=True)\n\n# merge X and y together\n df = pd.merge(X, y, left_index=True,\
|
87 |
+
\ right_index=True)\n\nprofile = why.log(pandas=df).profile().view()\n return\
|
88 |
+
\ df, profile\n\nHow do you use it?\n\nWhylogs's profiling functions take in a\
|
89 |
+
\ pandas.DataFrame dataset generate a DatasetProfileView object containing all\
|
90 |
+
\ the relevant information extracted from the dataset.\n\nThere are three ways\
|
91 |
+
\ you can use whylogs in your ZenML pipelines that allow different levels of flexibility:\n\
|
92 |
+
\ninstantiate, configure and insert the standard WhylogsProfilerStep shipped with\
|
93 |
+
\ ZenML into your pipelines. This is the easiest way and the recommended approach,\
|
94 |
+
\ but can only be customized through the supported step configuration parameters.\n\
|
95 |
+
\ncall the data validation methods provided by the whylogs Data Validator in your\
|
96 |
+
\ custom step implementation. This method allows for more flexibility concerning\
|
97 |
+
\ what can happen in the pipeline step, but you are still limited to the functionality\
|
98 |
+
\ implemented in the Data Validator.\n\nuse the whylogs library directly in your\
|
99 |
+
\ custom step implementation. This gives you complete freedom in how you are using\
|
100 |
+
\ whylogs's features.\n\nYou can visualize whylogs profiles in Jupyter notebooks\
|
101 |
+
\ or view them directly in the ZenML dashboard.\n\nThe whylogs standard step"
|
102 |
+
- " build to finish. More information: Build Timeout.We can register the image builder\
|
103 |
+
\ and use it in our active stack:\n\nzenml image-builder register <IMAGE_BUILDER_NAME>\
|
104 |
+
\ \\\n --flavor=gcp \\\n --cloud_builder_image=<BUILDER_IMAGE_NAME> \\\n\
|
105 |
+
\ --network=<DOCKER_NETWORK> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS>\n\
|
106 |
+
\n# Register and activate a stack with the new image builder\nzenml stack register\
|
107 |
+
\ <STACK_NAME> -i <IMAGE_BUILDER_NAME> ... --set\n\nYou also need to set up authentication\
|
108 |
+
\ required to access the Cloud Build GCP services.\n\nAuthentication Methods\n\
|
109 |
+
\nIntegrating and using a GCP Image Builder in your pipelines is not possible\
|
110 |
+
\ without employing some form of authentication. If you're looking for a quick\
|
111 |
+
\ way to get started locally, you can use the Local Authentication method. However,\
|
112 |
+
\ the recommended way to authenticate to the GCP cloud platform is through a GCP\
|
113 |
+
\ Service Connector. This is particularly useful if you are configuring ZenML\
|
114 |
+
\ stacks that combine the GCP Image Builder with other remote stack components\
|
115 |
+
\ also running in GCP.\n\nThis method uses the implicit GCP authentication available\
|
116 |
+
\ in the environment where the ZenML code is running. On your local machine, this\
|
117 |
+
\ is the quickest way to configure a GCP Image Builder. You don't need to supply\
|
118 |
+
\ credentials explicitly when you register the GCP Image Builder, as it leverages\
|
119 |
+
\ the local credentials and configuration that the Google Cloud CLI stores on\
|
120 |
+
\ your local machine. However, you will need to install and set up the Google\
|
121 |
+
\ Cloud CLI on your machine as a prerequisite, as covered in the Google Cloud\
|
122 |
+
\ documentation , before you register the GCP Image Builder.\n\nStacks using the\
|
123 |
+
\ GCP Image Builder set up with local authentication are not portable across environments.\
|
124 |
+
\ To make ZenML pipelines fully portable, it is recommended to use a GCP Service\
|
125 |
+
\ Connector to authenticate your GCP Image Builder to the GCP cloud platform."
|
126 |
+
- source_sentence: How can I register and set a stack with a new image builder using
|
127 |
+
ZenML?
|
128 |
+
sentences:
|
129 |
- 'ZenML - Bridging the gap between ML & Ops
|
130 |
|
131 |
|
|
|
139 |
|
140 |
|
141 |
Powered by GitBook'
|
142 |
+
- "> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS># Register and set a stack\
|
143 |
+
\ with the new image builder\nzenml stack register <STACK_NAME> -i <IMAGE_BUILDER_NAME>\
|
144 |
+
\ ... --set\n\nCaveats\n\nAs described in this Google Cloud Build documentation\
|
145 |
+
\ page, Google Cloud Build uses containers to execute the build steps which are\
|
146 |
+
\ automatically attached to a network called cloudbuild that provides some Application\
|
147 |
+
\ Default Credentials (ADC), that allow the container to be authenticated and\
|
148 |
+
\ therefore use other GCP services.\n\nBy default, the GCP Image Builder is executing\
|
149 |
+
\ the build command of the ZenML Pipeline Docker image with the option --network=cloudbuild,\
|
150 |
+
\ so the ADC provided by the cloudbuild network can also be used in the build.\
|
151 |
+
\ This is useful if you want to install a private dependency from a GCP Artifact\
|
152 |
+
\ Registry, but you will also need to use a custom base parent image with the\
|
153 |
+
\ keyrings.google-artifactregistry-auth installed, so pip can connect and authenticate\
|
154 |
+
\ in the private artifact registry to download the dependency.\n\nFROM zenmldocker/zenml:latest\n\
|
155 |
+
\nRUN pip install keyrings.google-artifactregistry-auth\n\nThe above Dockerfile\
|
156 |
+
\ uses zenmldocker/zenml:latest as a base image, but is recommended to change\
|
157 |
+
\ the tag to specify the ZenML version and Python version like 0.33.0-py3.10.\n\
|
158 |
+
\nPreviousKaniko Image BuilderNextDevelop a Custom Image Builder\n\nLast updated\
|
159 |
+
\ 21 days ago"
|
160 |
+
- "res Spark to handle the resource configuration.\"\"\"def _backend_configuration(\n\
|
161 |
+
\ self,\n spark_config: SparkConf,\n step_config:\
|
162 |
+
\ \"StepConfiguration\",\n ) -> None:\n \"\"\"Configures Spark to handle\
|
163 |
+
\ backends like YARN, Mesos or Kubernetes.\"\"\"\n\ndef _io_configuration(\n \
|
164 |
+
\ self,\n spark_config: SparkConf\n ) -> None:\n \
|
165 |
+
\ \"\"\"Configures Spark to handle different input/output sources.\"\"\"\n\n\
|
166 |
+
def _additional_configuration(\n self,\n spark_config: SparkConf\n\
|
167 |
+
\ ) -> None:\n \"\"\"Appends the user-defined configuration parameters.\"\
|
168 |
+
\"\"\n\ndef _launch_spark_job(\n self,\n spark_config: SparkConf,\n\
|
169 |
+
\ entrypoint_command: List[str]\n ) -> None:\n \"\"\"Generates\
|
170 |
+
\ and executes a spark-submit command.\"\"\"\n\ndef launch(\n self,\n\
|
171 |
+
\ info: \"StepRunInfo\",\n entrypoint_command: List[str],\n\
|
172 |
+
\ ) -> None:\n \"\"\"Launches the step on Spark.\"\"\"\n\nUnder the\
|
173 |
+
\ base configuration, you will see the main configuration parameters:\n\nmaster\
|
174 |
+
\ is the master URL for the cluster where Spark will run. You might see different\
|
175 |
+
\ schemes for this URL with varying cluster managers such as Mesos, YARN, or Kubernetes.\n\
|
176 |
+
\ndeploy_mode can either be 'cluster' (default) or 'client' and it decides where\
|
177 |
+
\ the driver node of the application will run.\n\nsubmit_args is the JSON string\
|
178 |
+
\ of a dictionary, which will be used to define additional parameters if required\
|
179 |
+
\ ( Spark has a wide variety of parameters, thus including them all in a single\
|
180 |
+
\ class was deemed unnecessary.).\n\nIn addition to this configuration, the launch\
|
181 |
+
\ method of the step operator gets additional configuration parameters from the\
|
182 |
+
\ DockerSettings and ResourceSettings. As a result, the overall configuration\
|
183 |
+
\ happens in 4 base methods:\n\n_resource_configuration translates the ZenML ResourceSettings\
|
184 |
+
\ object to Spark's own resource configuration.\n\n_backend_configuration is responsible\
|
185 |
+
\ for cluster-manager-specific configuration."
|
186 |
+
- source_sentence: How can I install ZenML with support for a local dashboard, and
|
187 |
+
what precautions should I take when installing on a Mac with Apple Silicon?
|
188 |
sentences:
|
189 |
+
- ' visit our PyPi package page.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
+
Running with Dockerzenml is also available as a Docker image hosted publicly on
|
193 |
+
DockerHub. Use the following command to get started in a bash environment with
|
194 |
+
zenml available:
|
195 |
|
|
|
|
|
196 |
|
197 |
+
docker run -it zenmldocker/zenml /bin/bash
|
198 |
|
|
|
199 |
|
200 |
+
If you would like to run the ZenML server with Docker:
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
+
docker run -it -d -p 8080:8080 zenmldocker/zenml-server
|
204 |
|
|
|
205 |
|
206 |
+
Deploying the server
|
207 |
|
|
|
208 |
|
209 |
+
Though ZenML can run entirely as a pip package on a local system, complete with
|
210 |
+
the dashboard. You can do this easily:
|
211 |
|
|
|
212 |
|
213 |
+
pip install "zenml[server]"
|
214 |
|
215 |
+
zenml up # opens the dashboard locally
|
|
|
216 |
|
217 |
|
218 |
+
However, advanced ZenML features are dependent on a centrally-deployed ZenML server
|
219 |
+
accessible to other MLOps stack components. You can read more about it here.
|
220 |
|
221 |
|
222 |
+
For the deployment of ZenML, you have the option to either self-host it or register
|
223 |
+
for a free ZenML Pro account.
|
224 |
|
225 |
|
226 |
+
PreviousIntroductionNextCore concepts
|
227 |
|
228 |
|
229 |
+
Last updated 20 days ago'
|
230 |
+
- 'Evaluation and metrics
|
|
|
|
|
|
|
231 |
|
232 |
|
233 |
+
Track how your RAG pipeline improves using evaluation and metrics.
|
234 |
|
235 |
|
236 |
+
PreviousBasic RAG inference pipelineNextEvaluation in 65 lines of code
|
237 |
|
238 |
|
239 |
+
Last updated 4 months ago'
|
240 |
- '🧙Installation
|
241 |
|
242 |
|
|
|
322 |
|
323 |
|
324 |
Running with Docker'
|
325 |
+
- source_sentence: How does the KubernetesSparkStepOperator utilize the PipelineDockerImageBuilder
|
326 |
+
class to manage Docker images for Spark jobs on Kubernetes?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
sentences:
|
328 |
+
- 'ZenML - Bridging the gap between ML & Ops
|
329 |
|
330 |
|
331 |
+
Legacy Docs
|
332 |
|
333 |
|
334 |
+
Bleeding EdgeLegacy Docs0.67.0
|
335 |
|
336 |
|
337 |
+
🧙♂️Find older version our docs
|
338 |
+
|
339 |
+
|
340 |
+
Powered by GitBook'
|
341 |
+
- "nsible for cluster-manager-specific configuration._io_configuration is a critical\
|
342 |
+
\ method. Even though we have materializers, Spark might require additional packages\
|
343 |
+
\ and configuration to work with a specific filesystem. This method is used as\
|
344 |
+
\ an interface to provide this configuration.\n\n_additional_configuration takes\
|
345 |
+
\ the submit_args, converts, and appends them to the overall configuration.\n\n\
|
346 |
+
Once the configuration is completed, _launch_spark_job comes into play. This takes\
|
347 |
+
\ the completed configuration and runs a Spark job on the given master URL with\
|
348 |
+
\ the specified deploy_mode. By default, this is achieved by creating and executing\
|
349 |
+
\ a spark-submit command.\n\nWarning\n\nIn its first iteration, the pre-configuration\
|
350 |
+
\ with _io_configuration method is only effective when it is paired with an S3ArtifactStore\
|
351 |
+
\ (which has an authentication secret). When used with other artifact store flavors,\
|
352 |
+
\ you might be required to provide additional configuration through the submit_args.\n\
|
353 |
+
\nStack Component: KubernetesSparkStepOperator\n\nThe KubernetesSparkStepOperator\
|
354 |
+
\ is implemented by subclassing the base SparkStepOperator and uses the PipelineDockerImageBuilder\
|
355 |
+
\ class to build and push the required Docker images.\n\nfrom typing import Optional\n\
|
356 |
+
\nfrom zenml.integrations.spark.step_operators.spark_step_operator import (\n\
|
357 |
+
\ SparkStepOperatorConfig\n)\n\nclass KubernetesSparkStepOperatorConfig(SparkStepOperatorConfig):\n\
|
358 |
+
\ \"\"\"Config for the Kubernetes Spark step operator.\"\"\"\n\nnamespace:\
|
359 |
+
\ Optional[str] = None\n service_account: Optional[str] = None\n\nfrom pyspark.conf\
|
360 |
+
\ import SparkConf\n\nfrom zenml.utils.pipeline_docker_image_builder import PipelineDockerImageBuilder\n\
|
361 |
+
from zenml.integrations.spark.step_operators.spark_step_operator import (\n \
|
362 |
+
\ SparkStepOperator\n)\n\nclass KubernetesSparkStepOperator(SparkStepOperator):\n\
|
363 |
+
\ \"\"\"Step operator which runs Steps with Spark on Kubernetes.\"\"\""
|
364 |
+
- "ngs/python/Dockerfile -u 0 build\n\nConfiguring RBACAdditionally, you may need\
|
365 |
+
\ to create the several resources in Kubernetes in order to give Spark access\
|
366 |
+
\ to edit/manage your driver executor pods.\n\nTo do so, create a file called\
|
367 |
+
\ rbac.yaml with the following content:\n\napiVersion: v1\nkind: Namespace\nmetadata:\n\
|
368 |
+
\ name: spark-namespace\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n\
|
369 |
+
\ name: spark-service-account\n namespace: spark-namespace\n---\napiVersion:\
|
370 |
+
\ rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: spark-role\n\
|
371 |
+
\ namespace: spark-namespace\nsubjects:\n - kind: ServiceAccount\n name:\
|
372 |
+
\ spark-service-account\n namespace: spark-namespace\nroleRef:\n kind: ClusterRole\n\
|
373 |
+
\ name: edit\n apiGroup: rbac.authorization.k8s.io\n---\n\nAnd then execute\
|
374 |
+
\ the following command to create the resources:\n\naws eks --region=$REGION update-kubeconfig\
|
375 |
+
\ --name=$EKS_CLUSTER_NAME\n\nkubectl create -f rbac.yaml\n\nLastly, note down\
|
376 |
+
\ the namespace and the name of the service account since you will need them when\
|
377 |
+
\ registering the stack component in the next step.\n\nHow to use it\n\nTo use\
|
378 |
+
\ the KubernetesSparkStepOperator, you need:\n\nthe ZenML spark integration. If\
|
379 |
+
\ you haven't installed it already, run\n\nzenml integration install spark\n\n\
|
380 |
+
Docker installed and running.\n\nA remote artifact store as part of your stack.\n\
|
381 |
+
\nA remote container registry as part of your stack.\n\nA Kubernetes cluster deployed.\n\
|
382 |
+
\nWe can then register the step operator and use it in our active stack:\n\nzenml\
|
383 |
+
\ step-operator register spark_step_operator \\\n\t--flavor=spark-kubernetes \\\
|
384 |
+
\n\t--master=k8s://$EKS_API_SERVER_ENDPOINT \\\n\t--namespace=<SPARK_KUBERNETES_NAMESPACE>\
|
385 |
+
\ \\\n\t--service_account=<SPARK_KUBERNETES_SERVICE_ACCOUNT>\n\n# Register the\
|
386 |
+
\ stack\nzenml stack register spark_stack \\\n -o default \\\n -s spark_step_operator\
|
387 |
+
\ \\\n -a spark_artifact_store \\\n -c spark_container_registry \\\n \
|
388 |
+
\ -i local_builder \\\n --set"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
pipeline_tag: sentence-similarity
|
390 |
library_name: sentence-transformers
|
391 |
metrics:
|
|
|
470 |
value: 0.75
|
471 |
name: Cosine Accuracy@1
|
472 |
- type: cosine_accuracy@3
|
473 |
+
value: 0.75
|
474 |
name: Cosine Accuracy@3
|
475 |
- type: cosine_accuracy@5
|
476 |
value: 1.0
|
|
|
482 |
value: 0.75
|
483 |
name: Cosine Precision@1
|
484 |
- type: cosine_precision@3
|
485 |
+
value: 0.25
|
486 |
name: Cosine Precision@3
|
487 |
- type: cosine_precision@5
|
488 |
value: 0.2
|
|
|
494 |
value: 0.75
|
495 |
name: Cosine Recall@1
|
496 |
- type: cosine_recall@3
|
497 |
+
value: 0.75
|
498 |
name: Cosine Recall@3
|
499 |
- type: cosine_recall@5
|
500 |
value: 1.0
|
|
|
503 |
value: 1.0
|
504 |
name: Cosine Recall@10
|
505 |
- type: cosine_ndcg@10
|
506 |
+
value: 0.8576691395183482
|
507 |
name: Cosine Ndcg@10
|
508 |
- type: cosine_mrr@10
|
509 |
+
value: 0.8125
|
510 |
name: Cosine Mrr@10
|
511 |
- type: cosine_map@100
|
512 |
+
value: 0.8125
|
513 |
name: Cosine Map@100
|
514 |
- task:
|
515 |
type: information-retrieval
|
|
|
625 |
|
626 |
### Model Description
|
627 |
- **Model Type:** Sentence Transformer
|
628 |
+
- **Base model:** [Snowflake/snowflake-arctic-embed-m-v1.5](https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v1.5) <!-- at revision 4d7418a980f09b897b7e08dcd981603eefde0e3f -->
|
629 |
- **Maximum Sequence Length:** 512 tokens
|
630 |
+
- **Output Dimensionality:** 768 dimensions
|
631 |
- **Similarity Function:** Cosine Similarity
|
632 |
- **Training Dataset:**
|
633 |
- json
|
|
|
668 |
model = SentenceTransformer("zenml/finetuned-snowflake-arctic-embed-m-v1.5")
|
669 |
# Run inference
|
670 |
sentences = [
|
671 |
+
'How does the KubernetesSparkStepOperator utilize the PipelineDockerImageBuilder class to manage Docker images for Spark jobs on Kubernetes?',
|
672 |
+
'nsible for cluster-manager-specific configuration._io_configuration is a critical method. Even though we have materializers, Spark might require additional packages and configuration to work with a specific filesystem. This method is used as an interface to provide this configuration.\n\n_additional_configuration takes the submit_args, converts, and appends them to the overall configuration.\n\nOnce the configuration is completed, _launch_spark_job comes into play. This takes the completed configuration and runs a Spark job on the given master URL with the specified deploy_mode. By default, this is achieved by creating and executing a spark-submit command.\n\nWarning\n\nIn its first iteration, the pre-configuration with _io_configuration method is only effective when it is paired with an S3ArtifactStore (which has an authentication secret). When used with other artifact store flavors, you might be required to provide additional configuration through the submit_args.\n\nStack Component: KubernetesSparkStepOperator\n\nThe KubernetesSparkStepOperator is implemented by subclassing the base SparkStepOperator and uses the PipelineDockerImageBuilder class to build and push the required Docker images.\n\nfrom typing import Optional\n\nfrom zenml.integrations.spark.step_operators.spark_step_operator import (\n SparkStepOperatorConfig\n)\n\nclass KubernetesSparkStepOperatorConfig(SparkStepOperatorConfig):\n """Config for the Kubernetes Spark step operator."""\n\nnamespace: Optional[str] = None\n service_account: Optional[str] = None\n\nfrom pyspark.conf import SparkConf\n\nfrom zenml.utils.pipeline_docker_image_builder import PipelineDockerImageBuilder\nfrom zenml.integrations.spark.step_operators.spark_step_operator import (\n SparkStepOperator\n)\n\nclass KubernetesSparkStepOperator(SparkStepOperator):\n """Step operator which runs Steps with Spark on Kubernetes."""',
|
673 |
+
"ngs/python/Dockerfile -u 0 build\n\nConfiguring RBACAdditionally, you may need to create the several resources in Kubernetes in order to give Spark access to edit/manage your driver executor pods.\n\nTo do so, create a file called rbac.yaml with the following content:\n\napiVersion: v1\nkind: Namespace\nmetadata:\n name: spark-namespace\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: spark-service-account\n namespace: spark-namespace\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: spark-role\n namespace: spark-namespace\nsubjects:\n - kind: ServiceAccount\n name: spark-service-account\n namespace: spark-namespace\nroleRef:\n kind: ClusterRole\n name: edit\n apiGroup: rbac.authorization.k8s.io\n---\n\nAnd then execute the following command to create the resources:\n\naws eks --region=$REGION update-kubeconfig --name=$EKS_CLUSTER_NAME\n\nkubectl create -f rbac.yaml\n\nLastly, note down the namespace and the name of the service account since you will need them when registering the stack component in the next step.\n\nHow to use it\n\nTo use the KubernetesSparkStepOperator, you need:\n\nthe ZenML spark integration. If you haven't installed it already, run\n\nzenml integration install spark\n\nDocker installed and running.\n\nA remote artifact store as part of your stack.\n\nA remote container registry as part of your stack.\n\nA Kubernetes cluster deployed.\n\nWe can then register the step operator and use it in our active stack:\n\nzenml step-operator register spark_step_operator \\\n\t--flavor=spark-kubernetes \\\n\t--master=k8s://$EKS_API_SERVER_ENDPOINT \\\n\t--namespace=<SPARK_KUBERNETES_NAMESPACE> \\\n\t--service_account=<SPARK_KUBERNETES_SERVICE_ACCOUNT>\n\n# Register the stack\nzenml stack register spark_stack \\\n -o default \\\n -s spark_step_operator \\\n -a spark_artifact_store \\\n -c spark_container_registry \\\n -i local_builder \\\n --set",
|
674 |
]
|
675 |
embeddings = model.encode(sentences)
|
676 |
print(embeddings.shape)
|
|
|
711 |
### Metrics
|
712 |
|
713 |
#### Information Retrieval
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
|
715 |
+
* Datasets: `dim_384`, `dim_256`, `dim_128` and `dim_64`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
717 |
|
718 |
+
| Metric | dim_384 | dim_256 | dim_128 | dim_64 |
|
719 |
+
|:--------------------|:----------|:-----------|:-----------|:----------|
|
720 |
+
| cosine_accuracy@1 | 0.75 | 0.75 | 0.75 | 0.75 |
|
721 |
+
| cosine_accuracy@3 | 1.0 | 0.75 | 0.75 | 1.0 |
|
722 |
+
| cosine_accuracy@5 | 1.0 | 1.0 | 1.0 | 1.0 |
|
723 |
+
| cosine_accuracy@10 | 1.0 | 1.0 | 1.0 | 1.0 |
|
724 |
+
| cosine_precision@1 | 0.75 | 0.75 | 0.75 | 0.75 |
|
725 |
+
| cosine_precision@3 | 0.3333 | 0.25 | 0.25 | 0.3333 |
|
726 |
+
| cosine_precision@5 | 0.2 | 0.2 | 0.2 | 0.2 |
|
727 |
+
| cosine_precision@10 | 0.1 | 0.1 | 0.1 | 0.1 |
|
728 |
+
| cosine_recall@1 | 0.75 | 0.75 | 0.75 | 0.75 |
|
729 |
+
| cosine_recall@3 | 1.0 | 0.75 | 0.75 | 1.0 |
|
730 |
+
| cosine_recall@5 | 1.0 | 1.0 | 1.0 | 1.0 |
|
731 |
+
| cosine_recall@10 | 1.0 | 1.0 | 1.0 | 1.0 |
|
732 |
+
| **cosine_ndcg@10** | **0.875** | **0.8577** | **0.8577** | **0.875** |
|
733 |
+
| cosine_mrr@10 | 0.8333 | 0.8125 | 0.8125 | 0.8333 |
|
734 |
+
| cosine_map@100 | 0.8333 | 0.8125 | 0.8125 | 0.8333 |
|
735 |
|
736 |
<!--
|
737 |
## Bias, Risks and Limitations
|
|
|
758 |
| | positive | anchor |
|
759 |
|:--------|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
|
760 |
| type | string | string |
|
761 |
+
| details | <ul><li>min: 13 tokens</li><li>mean: 23.11 tokens</li><li>max: 38 tokens</li></ul> | <ul><li>min: 31 tokens</li><li>mean: 299.64 tokens</li><li>max: 512 tokens</li></ul> |
|
762 |
* Samples:
|
763 |
+
| positive | anchor |
|
764 |
+
|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
765 |
+
| <code>How does the ZenML BaseService registry manage serialization and re-creation of configurations for BaseService instances as part of the remote model server setup?</code> | <code>e details of the deployment process from the user.It needs to act as a ZenML BaseService registry, where every BaseService instance is used as an internal representation of a remote model server (see the find_model_server abstract method). To achieve this, it must be able to re-create the configuration of a BaseService from information that is persisted externally, alongside, or even as part of the remote model server configuration itself. For example, for model servers that are implemented as Kubernetes resources, the BaseService instances can be serialized and saved as Kubernetes resource annotations. This allows the model deployer to keep track of all externally running model servers and to re-create their corresponding BaseService instance representations at any given time. The model deployer also defines methods that implement basic life-cycle management on remote model servers outside the coverage of a pipeline (see stop_model_server , start_model_server and delete_model_server)....</code> |
|
766 |
+
| <code>How do you ensure the MyExperimentTrackerFlavor is properly registered and available in ZenML?</code> | <code>gister flavors.my_flavor.MyExperimentTrackerFlavorZenML resolves the flavor class by taking the path where you initialized zenml (via zenml init) as the starting point of resolution. Therefore, please ensure you follow the best practice of initializing zenml at the root of your repository.<br><br>If ZenML does not find an initialized ZenML repository in any parent directory, it will default to the current working directory, but usually, it's better to not have to rely on this mechanism and initialize zenml at the root.<br><br>Afterward, you should see the new flavor in the list of available flavors:<br><br>zenml experiment-tracker flavor list<br><br>It is important to draw attention to when and how these base abstractions are coming into play in a ZenML workflow.<br><br>The CustomExperimentTrackerFlavor class is imported and utilized upon the creation of the custom flavor through the CLI.<br><br>The CustomExperimentTrackerConfig class is imported when someone tries to register/update a stack component with this custom fl...</code> |
|
767 |
+
| <code>How do you load and profile a dataset using the Whylogs data validator in ZenML?</code> | <code>ogsDataValidatorSettings,<br>)<br>from zenml import step@step(<br> settings={<br> "data_validator": WhylogsDataValidatorSettings(<br> enable_whylabs=True, dataset_id="model-1"<br> )<br> }<br>)<br>def data_loader() -> Tuple[<br> Annotated[pd.DataFrame, "data"],<br> Annotated[DatasetProfileView, "profile"]<br>]:<br> """Load the diabetes dataset."""<br> X, y = datasets.load_diabetes(return_X_y=True, as_frame=True)<br><br># merge X and y together<br> df = pd.merge(X, y, left_index=True, right_index=True)<br><br>profile = why.log(pandas=df).profile().view()<br> return df, profile<br><br>How do you use it?<br><br>Whylogs's profiling functions take in a pandas.DataFrame dataset generate a DatasetProfileView object containing all the relevant information extracted from the dataset.<br><br>There are three ways you can use whylogs in your ZenML pipelines that allow different levels of flexibility:<br><br>instantiate, configure and insert the standard WhylogsProfilerStep shipped with ZenML into your pipelines. This is the easiest ...</code> |
|
768 |
* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
|
769 |
```json
|
770 |
{
|
|
|
858 |
- `dataloader_num_workers`: 0
|
859 |
- `dataloader_prefetch_factor`: None
|
860 |
- `past_index`: -1
|
861 |
+
- `disable_tqdm`: False
|
862 |
- `remove_unused_columns`: True
|
863 |
- `label_names`: None
|
864 |
- `load_best_model_at_end`: True
|
|
|
912 |
- `optim_target_modules`: None
|
913 |
- `batch_eval_metrics`: False
|
914 |
- `eval_on_start`: False
|
|
|
915 |
- `eval_use_gather_object`: False
|
916 |
+
- `prompts`: None
|
917 |
- `batch_sampler`: no_duplicates
|
918 |
- `multi_dataset_batch_sampler`: proportional
|
919 |
|
920 |
</details>
|
921 |
|
922 |
### Training Logs
|
923 |
+
| Epoch | Step | dim_384_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |
|
924 |
|:-------:|:-----:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|
|
925 |
+
| **1.0** | **1** | **0.875** | **0.875** | **0.8577** | **0.875** |
|
926 |
+
| 2.0 | 3 | 0.875 | 0.8577 | 0.8577 | 0.875 |
|
927 |
+
| 3.0 | 4 | 0.875 | 0.8577 | 0.8577 | 0.875 |
|
928 |
|
929 |
* The bold row denotes the saved checkpoint.
|
930 |
|
931 |
### Framework Versions
|
932 |
+
- Python: 3.11.10
|
933 |
+
- Sentence Transformers: 3.3.1
|
934 |
+
- Transformers: 4.43.1
|
935 |
+
- PyTorch: 2.5.1+cu124
|
936 |
+
- Accelerate: 1.1.1
|
937 |
+
- Datasets: 3.1.0
|
938 |
+
- Tokenizers: 0.19.1
|
939 |
|
940 |
## Citation
|
941 |
|
config.json
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
"pad_token_id": 0,
|
20 |
"position_embedding_type": "absolute",
|
21 |
"torch_dtype": "float32",
|
22 |
-
"transformers_version": "4.
|
23 |
"type_vocab_size": 2,
|
24 |
"use_cache": true,
|
25 |
"vocab_size": 30522
|
|
|
19 |
"pad_token_id": 0,
|
20 |
"position_embedding_type": "absolute",
|
21 |
"torch_dtype": "float32",
|
22 |
+
"transformers_version": "4.43.1",
|
23 |
"type_vocab_size": 2,
|
24 |
"use_cache": true,
|
25 |
"vocab_size": 30522
|
config_sentence_transformers.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
{
|
2 |
"__version__": {
|
3 |
-
"sentence_transformers": "3.
|
4 |
-
"transformers": "4.
|
5 |
-
"pytorch": "2.5.
|
6 |
},
|
7 |
"prompts": {
|
8 |
"query": "Represent this sentence for searching relevant passages: "
|
9 |
},
|
10 |
"default_prompt_name": null,
|
11 |
-
"similarity_fn_name":
|
12 |
}
|
|
|
1 |
{
|
2 |
"__version__": {
|
3 |
+
"sentence_transformers": "3.3.1",
|
4 |
+
"transformers": "4.43.1",
|
5 |
+
"pytorch": "2.5.1+cu124"
|
6 |
},
|
7 |
"prompts": {
|
8 |
"query": "Represent this sentence for searching relevant passages: "
|
9 |
},
|
10 |
"default_prompt_name": null,
|
11 |
+
"similarity_fn_name": "cosine"
|
12 |
}
|