Kevin Hu
commited on
Commit
·
02b8c59
1
Parent(s):
0e7a78d
refine dockerfile (#1801)
Browse files### What problem does this PR solve?
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- Dockerfile +1 -1
- Dockerfile.arm +1 -1
- Dockerfile.cuda +1 -1
- Dockerfile.scratch +1 -1
- Dockerfile.scratch.oc9 +1 -1
- graphrag/leiden.py +3 -1
Dockerfile
CHANGED
|
@@ -10,7 +10,7 @@ ADD ./api ./api
|
|
| 10 |
ADD ./conf ./conf
|
| 11 |
ADD ./deepdoc ./deepdoc
|
| 12 |
ADD ./rag ./rag
|
| 13 |
-
ADD ./
|
| 14 |
|
| 15 |
ENV PYTHONPATH=/ragflow/
|
| 16 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
|
|
|
| 10 |
ADD ./conf ./conf
|
| 11 |
ADD ./deepdoc ./deepdoc
|
| 12 |
ADD ./rag ./rag
|
| 13 |
+
ADD ./agent ./agent
|
| 14 |
|
| 15 |
ENV PYTHONPATH=/ragflow/
|
| 16 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
Dockerfile.arm
CHANGED
|
@@ -21,7 +21,7 @@ ADD ./api ./api
|
|
| 21 |
ADD ./conf ./conf
|
| 22 |
ADD ./deepdoc ./deepdoc
|
| 23 |
ADD ./rag ./rag
|
| 24 |
-
ADD ./
|
| 25 |
|
| 26 |
ENV PYTHONPATH=/ragflow/
|
| 27 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
|
|
|
| 21 |
ADD ./conf ./conf
|
| 22 |
ADD ./deepdoc ./deepdoc
|
| 23 |
ADD ./rag ./rag
|
| 24 |
+
ADD ./agent ./agent
|
| 25 |
|
| 26 |
ENV PYTHONPATH=/ragflow/
|
| 27 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
Dockerfile.cuda
CHANGED
|
@@ -15,7 +15,7 @@ ADD ./api ./api
|
|
| 15 |
ADD ./conf ./conf
|
| 16 |
ADD ./deepdoc ./deepdoc
|
| 17 |
ADD ./rag ./rag
|
| 18 |
-
ADD ./
|
| 19 |
|
| 20 |
ENV PYTHONPATH=/ragflow/
|
| 21 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
|
|
|
| 15 |
ADD ./conf ./conf
|
| 16 |
ADD ./deepdoc ./deepdoc
|
| 17 |
ADD ./rag ./rag
|
| 18 |
+
ADD ./agent ./agent
|
| 19 |
|
| 20 |
ENV PYTHONPATH=/ragflow/
|
| 21 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
Dockerfile.scratch
CHANGED
|
@@ -30,7 +30,7 @@ ADD ./conf ./conf
|
|
| 30 |
ADD ./deepdoc ./deepdoc
|
| 31 |
ADD ./rag ./rag
|
| 32 |
ADD ./requirements.txt ./requirements.txt
|
| 33 |
-
ADD ./
|
| 34 |
|
| 35 |
RUN apt install openmpi-bin openmpi-common libopenmpi-dev
|
| 36 |
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu/openmpi/lib:$LD_LIBRARY_PATH
|
|
|
|
| 30 |
ADD ./deepdoc ./deepdoc
|
| 31 |
ADD ./rag ./rag
|
| 32 |
ADD ./requirements.txt ./requirements.txt
|
| 33 |
+
ADD ./agent ./agent
|
| 34 |
|
| 35 |
RUN apt install openmpi-bin openmpi-common libopenmpi-dev
|
| 36 |
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu/openmpi/lib:$LD_LIBRARY_PATH
|
Dockerfile.scratch.oc9
CHANGED
|
@@ -30,7 +30,7 @@ ADD ./conf ./conf
|
|
| 30 |
ADD ./deepdoc ./deepdoc
|
| 31 |
ADD ./rag ./rag
|
| 32 |
ADD ./requirements.txt ./requirements.txt
|
| 33 |
-
ADD ./
|
| 34 |
|
| 35 |
RUN dnf install -y openmpi openmpi-devel python3-openmpi
|
| 36 |
ENV C_INCLUDE_PATH /usr/include/openmpi-x86_64:$C_INCLUDE_PATH
|
|
|
|
| 30 |
ADD ./deepdoc ./deepdoc
|
| 31 |
ADD ./rag ./rag
|
| 32 |
ADD ./requirements.txt ./requirements.txt
|
| 33 |
+
ADD ./agent ./agent
|
| 34 |
|
| 35 |
RUN dnf install -y openmpi openmpi-devel python3-openmpi
|
| 36 |
ENV C_INCLUDE_PATH /usr/include/openmpi-x86_64:$C_INCLUDE_PATH
|
graphrag/leiden.py
CHANGED
|
@@ -25,6 +25,7 @@ from graspologic.partition import hierarchical_leiden
|
|
| 25 |
from graspologic.utils import largest_connected_component
|
| 26 |
|
| 27 |
import networkx as nx
|
|
|
|
| 28 |
|
| 29 |
log = logging.getLogger(__name__)
|
| 30 |
|
|
@@ -91,13 +92,14 @@ def _compute_leiden_communities(
|
|
| 91 |
seed=0xDEADBEEF,
|
| 92 |
) -> dict[int, dict[str, int]]:
|
| 93 |
"""Return Leiden root communities."""
|
|
|
|
|
|
|
| 94 |
if use_lcc:
|
| 95 |
graph = stable_largest_connected_component(graph)
|
| 96 |
|
| 97 |
community_mapping = hierarchical_leiden(
|
| 98 |
graph, max_cluster_size=max_cluster_size, random_seed=seed
|
| 99 |
)
|
| 100 |
-
results: dict[int, dict[str, int]] = {}
|
| 101 |
for partition in community_mapping:
|
| 102 |
results[partition.level] = results.get(partition.level, {})
|
| 103 |
results[partition.level][partition.node] = partition.cluster
|
|
|
|
| 25 |
from graspologic.utils import largest_connected_component
|
| 26 |
|
| 27 |
import networkx as nx
|
| 28 |
+
from networkx import is_empty
|
| 29 |
|
| 30 |
log = logging.getLogger(__name__)
|
| 31 |
|
|
|
|
| 92 |
seed=0xDEADBEEF,
|
| 93 |
) -> dict[int, dict[str, int]]:
|
| 94 |
"""Return Leiden root communities."""
|
| 95 |
+
results: dict[int, dict[str, int]] = {}
|
| 96 |
+
if is_empty(graph): return results
|
| 97 |
if use_lcc:
|
| 98 |
graph = stable_largest_connected_component(graph)
|
| 99 |
|
| 100 |
community_mapping = hierarchical_leiden(
|
| 101 |
graph, max_cluster_size=max_cluster_size, random_seed=seed
|
| 102 |
)
|
|
|
|
| 103 |
for partition in community_mapping:
|
| 104 |
results[partition.level] = results.get(partition.level, {})
|
| 105 |
results[partition.level][partition.node] = partition.cluster
|