Skip to content

Commit e87e98d

Browse files
authored
Add memgraph 3.6.1 (#1442)
1 parent 2c75fb4 commit e87e98d

File tree

5 files changed

+197
-9
lines changed

5 files changed

+197
-9
lines changed

pages/advanced-algorithms/available-algorithms/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default {
1919
"degree_centrality": "degree_centrality",
2020
"distance_calculator": "distance_calculator",
2121
"elasticsearch_synchronization": "elasticsearch_synchronization",
22+
"embeddings": "embeddings",
2223
"export_util": "export_util",
2324
"gnn_link_prediction": "gnn_link_prediction",
2425
"gnn_node_classification": "gnn_node_classification",
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
title: embeddings
3+
description: Calculate sentence embeddings on node strings using pytorch.
4+
---
5+
6+
# embeddings
7+
8+
import { Cards } from 'nextra/components'
9+
import GitHub from '/components/icons/GitHub'
10+
11+
The embeddings module provides tools for calculating sentence embeddings on node strings using pytorch.
12+
13+
<Cards>
14+
<Cards.Card
15+
icon={<GitHub />}
16+
title="Source code"
17+
href="https://github.com/memgraph/mage/blob/main/python/embeddings.py"
18+
/>
19+
</Cards>
20+
21+
| Trait | Value |
22+
| ------------------- | ------------------- |
23+
| **Module type** | algorithm |
24+
| **Implementation** | Python |
25+
| **Parallelism** | parallel |
26+
27+
28+
## Procedures
29+
30+
### `compute()`
31+
32+
The procedure computes the sentence embeddings on the string properties of nodes. Embeddings are
33+
created as a property of the nodes in the graph.
34+
35+
{<h4 className="custom-header"> Input: </h4>}
36+
37+
- `input_nodes: List[Vertex]` (**OPTIONAL**) ➡ The list of nodes to compute the embeddings for. If not provided, the embeddings are computed for all nodes in the graph.
38+
- `embedding_property: string` ➡ The name of the property to store the embeddings in. This property is `embedding` by default.
39+
- `excluded_properties: List[string]` ➡ The list of properties to exclude from the embeddings computation. This list is empty by default.
40+
- `model_name: string` ➡ The name of the model to use for the embeddings computation, buy default this module uses the `all-MiniLM-L6-v2` model provided by the `sentence-transformers` library.
41+
- `batch_size: int` ➡ The batch size to use for the embeddings computation. This is set to `2000` by default.
42+
- `chunk_size: int` ➡ The number of batches per "chunk". This is used when computing embeddings across multiple GPUs, as this has to be done by spawning multiple processes. Each spawned process computes the embeddings for a single chunk. This is set to 48 by default.
43+
- `device: string|int|List[string|int]` ➡ The device to use for the embeddings computation. This can be any of the following:
44+
- `"cpu"` - Use CPU for computation.
45+
- `"cuda"` or `"all"` - Use all available CUDA devices for computation.
46+
- `"cuda:id"` - Use a specific CUDA device for computation.
47+
- `id` - Use a specific device for computation.
48+
- `[id1, id2, ...]` - Use a list of device ids for computation.
49+
- `["cuda:id1", "cuda:id2", ...]` - Use a list of CUDA devices for computation.
50+
by default, the first device (`0`) is used.
51+
52+
{<h4 className="custom-header"> Output: </h4>}
53+
54+
- `success: bool` ➡ Whether the embeddings computation was successful.
55+
56+
{<h4 className="custom-header"> Usage: </h4>}
57+
58+
To compute the embeddings across the entire graph with the default parameters, use the following query:
59+
60+
```cypher
61+
CALL embeddings.compute()
62+
YIELD success;
63+
```
64+
65+
To compute the embeddings for a specific list of nodes, use the following query:
66+
67+
68+
```cypher
69+
MATCH (n)
70+
WITH n ORDER BY id(n)
71+
LIMIT 5
72+
WITH collect(n) AS subset
73+
CALL embeddings.compute(subset)
74+
YIELD success;
75+
```
76+
77+
To run the computation on specific device(s), use the following query:
78+
79+
```cypher
80+
CALL embeddings.compute(
81+
NULL,
82+
"embedding",
83+
NULL,
84+
"all-MiniLM-L6-v2",
85+
2000,
86+
48,
87+
"cuda:1"
88+
)
89+
YIELD success;
90+
```
91+
92+
93+
## Example
94+
95+
Create the following graph:
96+
97+
```cypher
98+
CREATE (n:Node {id: 1, Title: "Stilton", Description: "A stinky cheese from the UK"}),
99+
(n:Node {id: 2, Title: "Roquefort", Description: "A blue cheese from France"}),
100+
(n:Node {id: 3, Title: "Cheddar", Description: "A yellow cheese from the UK"}),
101+
(n:Node {id: 4, Title: "Gouda", Description: "A Dutch cheese"}),
102+
(n:Node {id: 5, Title: "Parmesan", Description: "An Italian cheese"}),
103+
(n:Node {id: 6, Title: "Red Leicester", Description: "The best cheese in the world"});
104+
```
105+
106+
Run the following query to compute the embeddings:
107+
108+
```cypher
109+
CALL embeddings.compute()
110+
YIELD success;
111+
112+
MATCH (n)
113+
WHERE n.embedding IS NOT NULL
114+
RETURN n.Title, n.embedding;
115+
```
116+
117+
Results:
118+
119+
```plaintext
120+
+---------+
121+
| success |
122+
+---------+
123+
| true |
124+
+---------+
125+
+----------------------------------------------------------------------+----------------------------------------------------------------------+
126+
| n.Title | n.embedding |
127+
+----------------------------------------------------------------------+----------------------------------------------------------------------+
128+
| "Stilton" | [-0.0485366, -0.021823, 0.0159757, 0.0376443, 0.00594089, -0.0044... |
129+
| "Roquefort" | [-0.0252884, 0.0250485, -0.0249728, 0.0571037, 0.0386177, 0.03863... |
130+
| "Cheddar" | [-0.0129724, -0.00756301, -0.00379329, 0.0037531, -0.0134941, 0.0... |
131+
| "Gouda" | [0.0128716, 0.025435, -0.0288951, 0.0177759, -0.0624398, 0.043577... |
132+
| "Parmesan" | [-0.0755439, 0.00906182, -0.010977, 0.0208911, -0.0527448, 0.0085... |
133+
| "Red Leicester" | [-0.0244318, -0.0280038, -0.0373183, 0.0284436, -0.0277753, 0.066... |
134+
+----------------------------------------------------------------------+----------------------------------------------------------------------+
135+
```

pages/advanced-algorithms/install-mage.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ The following tags are available on Docker Hub:
3333
- `x.y` - production MAGE image
3434
- `x.y-relwithdebinfo` - contains debugging symbols and `gdb`
3535
- `x.y-malloc` - Memgraph compiled with `malloc`instead of `jemalloc` (x86_64 only)
36+
- `x.y-relwithdebinfo-cuda` - Memgraph built with CUDA support* - available since version `3.6.1`.
37+
38+
*To run GPU-accelerated algorithms, you need to launch the container with the `--gpus all` flag.
3639

3740
For versions prior to `3.2`, MAGE image tags included both MAGE and Memgraph versions, e.g.
3841

@@ -125,9 +128,18 @@ curl https://sh.rustup.rs -sSf | sh -s -- -y
125128
export PATH="/root/.cargo/bin:${PATH}"
126129
python3 -m pip install -r python/requirements.txt
127130
python3 -m pip install -r cpp/memgraph/src/auth/reference_modules/requirements.txt
128-
python3 -m pip install torch-sparse torch-cluster torch-spline-conv torch-geometric torch-scatter -f https://data.pyg.org/whl/torch-2.3.0+cpu.html
129-
python3 -m pip install dgl -f https://data.dgl.ai/wheels/torch-2.3/repo.html
131+
python3 -m pip install torch-sparse torch-cluster torch-spline-conv torch-geometric torch-scatter -f https://data.pyg.org/whl/torch-2.6.0+cpu.html
132+
python3 -m pip install dgl -f https://data.dgl.ai/wheels/torch-2.6/repo.html
133+
```
134+
135+
<Callout type="info">
136+
137+
To install the dependencies for GPU-accelerated algorithms, you need to use the GPU-specific requirements file:
138+
139+
```shell
140+
python3 -m pip install -r python/requirements-gpu.txt
130141
```
142+
</Callout>
131143

132144
{<h3 className="custom-header">Run the `setup` script</h3>}
133145

pages/fundamentals/data-types.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,13 @@ CREATE (:Flight {AIR123: datetime("2021-04-21T14:15:00Z")});
622622

623623
Maps for constructing `ZonedDateTime` values may have the following fields:
624624
`year`, `month`, `day`, `hour`, `minute`, `second`, `millisecond`,
625-
`microsecond` and `timezone`.
625+
`microsecond` and `timezone`.
626+
- If some numeric fields are omitted, they default to the lowest value for that field:
627+
- `0` for `year`, `hour`, `minute`, `second`, `millisecond`, and `microsecond`.
628+
- `1` for `month` and `day`.
629+
- If the `timezone` is omitted, it defaults to UTC.
630+
- If all numeric fields are omitted and only the `timezone` is specified, then a `datetime`
631+
represents the **current time** in the that timezone.
626632

627633
There are two options for the `timezone` field:
628634
* string: timezone name from the

pages/release-notes.mdx

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,46 @@ troubleshoot in production.
4242

4343
## 🚀 Latest release
4444

45+
### Memgraph v3.6.1 - October 16th, 2025
46+
47+
{<h4 className="custom-header">⚠️ Breaking changes</h4>}
48+
49+
- Changed the behaviour of calls like `datetime({timezone:"Europe/Brussels"})`.
50+
Such calls return the current clock time. If you need the previous behaviour,
51+
then explicitly state one or more numeric fields as `0`, e.g,
52+
`datetime({year: 0, timezone:"Europe/Brussels"}`.
53+
[#3339](https://github.com/memgraph/memgraph/pull/3339)
54+
55+
{<h4 className="custom-header">🐞 Bug fixes</h4>}
56+
57+
- Fixed `convert_c.to_tree()` memory leak. Using `to_tree` will not indefinably
58+
increase the memory. [#3333](https://github.com/memgraph/memgraph/pull/3333)
59+
- Fixed an issue where `SHOW PRIVILEGES` ignored the target user's database
60+
access rights. The `SHOW PRIVILEGES` now works correctly and will return an
61+
empty result if the user does not have access to the target database.
62+
[#3340](https://github.com/memgraph/memgraph/pull/3340)
63+
- Fixed a cache invalidation bug that would cause the IN LIST operator to
64+
produce wrong results.
65+
[#3342](https://github.com/memgraph/memgraph/pull/3342)
66+
- Fixed `datetime()` calls with only a `timezone` parameter (e.g.,
67+
`datetime({timezone:"Europe/Brussels"})`) to return the current clock time,
68+
instead of a time with all numeric fields set to their minimum value.
69+
[#3339](https://github.com/memgraph/memgraph/pull/3339)
70+
71+
### MAGE v3.6.1 - October 16th, 2025
72+
73+
{<h4 className="custom-header">✨ New features</h4>}
74+
75+
- Added `embedding` module, allowing users to compute sentence embeddings for
76+
vertices on CPU or Nvidia GPU.
77+
[#662](https://github.com/memgraph/mage/pull/662).
78+
79+
### Lab v3.6.0 - October 8th, 2025
80+
81+
<LabReleasesClient version="3.6.0" />
82+
83+
## Previous releases
84+
4585
### Memgraph v3.6.0 - October 8th, 2025
4686

4787
{<h4 className="custom-header">⚠️ Breaking changes</h4>}
@@ -195,12 +235,6 @@ troubleshoot in production.
195235
- Fixed closing of database connections after migrations are completed.
196236
[#665](https://github.com/memgraph/mage/pull/665)
197237

198-
### Lab v3.6.0 - October 8th, 2025
199-
200-
<LabReleasesClient version="3.6.0" />
201-
202-
## Previous releases
203-
204238
### Memgraph v3.5.2 - September 24th, 2025
205239

206240
{<h4 className="custom-header">✨ New features</h4>}

0 commit comments

Comments
 (0)