-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up transducer build #1159
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,20 +1,7 @@ | ||||||||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.5) | ||||||||||
|
||||||||||
PROJECT(rnnt_release) | ||||||||||
|
||||||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this as I do not see this reflected in build logs. |
||||||||||
|
||||||||||
IF(APPLE) | ||||||||||
ADD_DEFINITIONS(-DAPPLE) | ||||||||||
ENDIF() | ||||||||||
|
||||||||||
INCLUDE_DIRECTORIES(submodule/include) | ||||||||||
|
||||||||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PIC argument has to be consistent across all the libraries. The current configuration works without this explicit line, but I moved this to the top level |
||||||||||
|
||||||||||
ADD_DEFINITIONS(-DRNNT_DISABLE_OMP) | ||||||||||
|
||||||||||
IF(APPLE) | ||||||||||
ADD_DEFINITIONS(-DAPPLE) | ||||||||||
EXEC_PROGRAM(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION) | ||||||||||
STRING(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) | ||||||||||
MESSAGE(STATUS "DARWIN_VERSION=${DARWIN_VERSION}") | ||||||||||
|
@@ -30,9 +17,11 @@ ELSE() | |||||||||
ENDIF() | ||||||||||
|
||||||||||
ADD_LIBRARY(warprnnt STATIC submodule/src/rnnt_entrypoint.cpp) | ||||||||||
target_include_directories(warprnnt PUBLIC submodule/include) | ||||||||||
set_target_properties(warprnnt PROPERTIES PUBLIC_HEADER submodule/include/rnnt.h) | ||||||||||
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the commands are capitablized in this file :)
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intended. only ancient CMake should use all capitals. I could have lowercased others but I left them untouched. |
||||||||||
|
||||||||||
INSTALL(TARGETS warprnnt | ||||||||||
LIBRARY DESTINATION "lib" | ||||||||||
ARCHIVE DESTINATION "lib") | ||||||||||
|
||||||||||
INSTALL(FILES submodule/include/rnnt.h DESTINATION "submodule/include") | ||||||||||
INSTALL( | ||||||||||
TARGETS warprnnt | ||||||||||
ARCHIVE DESTINATION "lib" | ||||||||||
PUBLIC_HEADER DESTINATION "include") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#ifdef BUILD_TRANSDUCER | ||
|
||
#include <iostream> | ||
#include <numeric> | ||
#include <string> | ||
|
@@ -8,6 +6,8 @@ | |
#include <torch/script.h> | ||
#include "rnnt.h" | ||
|
||
namespace { | ||
|
||
int64_t cpu_rnnt_loss(torch::Tensor acts, | ||
torch::Tensor labels, | ||
torch::Tensor input_lengths, | ||
|
@@ -75,8 +75,19 @@ int64_t cpu_rnnt_loss(torch::Tensor acts, | |
return -1; | ||
} | ||
|
||
} // namespace | ||
|
||
TORCH_LIBRARY_IMPL(torchaudio, CPU, m) { | ||
m.impl("rnnt_loss", &cpu_rnnt_loss); | ||
m.impl("rnnt_loss", &cpu_rnnt_loss); | ||
} | ||
|
||
#endif | ||
TORCH_LIBRARY_FRAGMENT(torchaudio, m) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
m.def("rnnt_loss(Tensor acts," | ||
"Tensor labels," | ||
"Tensor input_lengths," | ||
"Tensor label_lengths," | ||
"Tensor costs," | ||
"Tensor grads," | ||
"int blank_label," | ||
"int num_threads) -> int"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instrall
target is only defined when building transducer.