Skip to content

Commit e45d0a0

Browse files
committed
fix some doc strings
1 parent 7bf1532 commit e45d0a0

File tree

5 files changed

+32
-26
lines changed

5 files changed

+32
-26
lines changed

CMakeLists.txt

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
1-
if (WIN32)
2-
cmake_minimum_required(VERSION 3.8)
1+
if (WIN32 OR APPLE)
2+
set(SKIP_TOOLCHAIN TRUE)
3+
endif()
4+
5+
if (SKIP_TOOLCHAIN)
6+
# skip toolchain so that code insight can work properly
7+
cmake_minimum_required(VERSION 3.0)
38
project(graphvite LANGUAGES CXX)
4-
else ()
5-
cmake_minimum_required(VERSION 3.12)
6-
project(graphvite LANGUAGES CXX CUDA)
7-
endif ()
9+
include_directories(include)
10+
add_subdirectory(src)
11+
return()
12+
endif()
13+
14+
cmake_minimum_required(VERSION 3.12)
15+
project(graphvite LANGUAGES CXX CUDA)
816

917
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
1018
include(FindCUDA)
1119

12-
if (WIN32)
13-
find_package(Glog)
14-
find_package(GFlags)
15-
else ()
16-
find_package(Glog)
17-
find_package(GFlags)
18-
find_package(PythonLibsNew REQUIRED)
19-
find_package(pybind11 REQUIRED)
20-
endif ()
20+
find_package(Glog)
21+
find_package(GFlags)
22+
find_package(PythonLibsNew REQUIRED)
23+
find_package(pybind11 REQUIRED)
2124

2225
# CUDA_ROOT & CUDA_ARCH
2326
get_filename_component(CUDA_ROOT ${CMAKE_CUDA_COMPILER} DIRECTORY)
2427
get_filename_component(CUDA_ROOT ${CUDA_ROOT} DIRECTORY)
2528
if (NOT ALL_ARCH)
2629
cuda_select_nvcc_arch_flags(CUDA_ARCH Auto)
2730
else()
28-
cuda_select_nvcc_arch_flags(CUDA_ARCH 5.2 6.0 7.0)
31+
cuda_select_nvcc_arch_flags(CUDA_ARCH 3.5 5.0 6.0 7.0)
2932
endif()
3033
string(REPLACE ";" " " CUDA_ARCH "${CUDA_ARCH}")
3134

@@ -57,7 +60,9 @@ if (NOT GLOG_FOUND)
5760
include_directories(${PROJECT_BINARY_DIR}/glog/include)
5861
link_directories(${PROJECT_BINARY_DIR}/glog/.libs)
5962
else()
63+
get_filename_component(GLOG_LIBRARY_DIR ${GLOG_LIBRARY} DIRECTORY)
6064
include_directories(${GLOG_INCLUDE_DIR})
65+
link_directories(${GLOG_LIBRARY_DIR})
6166
endif ()
6267

6368
# gflags
@@ -77,7 +82,9 @@ if (NOT GFLAGS_FOUND)
7782
include_directories(${PROJECT_BINARY_DIR}/gflags/include)
7883
link_directories(${PROJECT_BINARY_DIR}/gflags/lib)
7984
else()
85+
get_filename_component(GFLAGS_LIBRARY_DIR ${GFLAGS_LIBRARY} DIRECTORY)
8086
include_directories(${GFLAGS_INCLUDE_DIR})
87+
link_directories(${GFLAGS_LIBRARY_DIR})
8188
endif()
8289

8390
# faiss

config/word_graph/line_wikipedia.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build:
1616
type: SGD
1717
lr: 0.025
1818
weight_decay: 0.005
19-
num_partition: 0
19+
num_partition: auto
2020
num_negative: 1
2121
batch_size: 100000
2222
episode_size: 1000

include/bind.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class pyKNNGraph : public py::class_<graphvite::KNNGraph<Index>, graphvite::Grap
357357
vectors (2D array_like): vector list
358358
num_neighbor (int, optional): number of neighbors for each node
359359
perplexity (int, optional): perplexity for the neighborhood of each node
360-
normalization (bool, optional): normalize the input vectors or not
360+
vector_normalization (bool, optional): normalize the input vectors or not
361361
delimiters (str, optional): string of delimiter characters
362362
comment (str, optional): prefix of comment strings
363363
)");
@@ -563,10 +563,10 @@ class pyKnowledgeGraphSolver : public py::class_<graphvite::KnowledgeGraphSolver
563563
)");
564564

565565
def("train", &KnowledgeGraphSolver::train, py::no_gil(),
566-
py::arg("model") = "RotatE", py::arg("num_epoch") = 2000, py::arg("resume") = false, py::arg("margin") = 24,
566+
py::arg("model") = "RotatE", py::arg("num_epoch") = 2000, py::arg("resume") = false, py::arg("margin") = 12,
567567
py::arg("l3_regularization") = 2e-3, py::arg("sample_batch_size") = 2000, py::arg("positive_reuse") = 1,
568568
py::arg("adversarial_temperature") = 2, py::arg("log_frequency") = 100,
569-
"train(model='RotatE', num_epoch=2000, resume=False, margin=24, l3_regularization=2e-3, "
569+
"train(model='RotatE', num_epoch=2000, resume=False, margin=12, l3_regularization=2e-3, "
570570
"sample_batch_size=2000, positive_reuse=1, adversarial_temperature=2, log_frequency=100)"
571571
R"(
572572
Train knowledge graph embeddings.
@@ -681,7 +681,7 @@ class pyVisualizationSolver : public py::class_<graphvite::VisualizationSolver<d
681681
resume (bool, optional): resume training from learned embeddings or not
682682
sample_batch_size (int, optional): batch size of samples in samplers
683683
positive_reuse (int, optional): times of reusing positive samples
684-
negative_sample_epoxnent (float, optional): exponent of degrees in negative sampling
684+
negative_sample_exponent (float, optional): exponent of degrees in negative sampling
685685
negative_weight (float, optional): weight for each negative sample
686686
log_frequency (int, optional): log every log_frequency batches
687687
)");

python/graphvite/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525
from . import util
2626

27-
package_path = os.path.dirname(os.path.realpath(__file__))
27+
package_path = os.path.dirname(__file__)
2828
candidate_paths = [
29-
os.path.join(package_path, "lib"),
30-
os.path.join(package_path, "../../lib"),
31-
os.path.join(package_path, "../../build/lib")
29+
os.path.realpath(os.path.join(package_path, "lib")),
30+
os.path.realpath(os.path.join(package_path, "../../lib")),
31+
os.path.realpath(os.path.join(package_path, "../../build/lib"))
3232
]
3333
lib_file = imp.find_module("libgraphvite", candidate_paths)[1]
3434
lib_path = os.path.dirname(lib_file)

python/graphvite/cmd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ def baseline_main(args):
147147
file = os.path.join(path, file)
148148
match = True
149149
for keyword in args.keywords:
150-
# print("(^|_)%s(_|$)" % keyword)
151150
result = re.search("[/\_.]%s[/\_.]" % keyword, file)
152151
if not result:
153152
match = False

0 commit comments

Comments
 (0)