-
Notifications
You must be signed in to change notification settings - Fork 535
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
add simple JS backend #2072
base: master
Are you sure you want to change the base?
add simple JS backend #2072
Conversation
@@ -45,7 +45,7 @@ struct WeightsToOnnxConverterOptions { | |||
std::string output_mlh = "/output/mlh"; | |||
int batch_size = -1; | |||
int opset = 17; | |||
bool alt_mish = false; // Use "Mish" approximation (fp32 only). | |||
bool alt_mish = true; // Use "Mish" approximation (fp32 only). |
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.
This is not the way to do it, add a flag in leela2onnx.cc
.
return PopulateStdNodeFields(node, name, input, "Selu"); | ||
auto out = PopulateStdNodeFields(node, name + "/elu", input, "Elu"); | ||
AddFloatAttribute(node, "alpha", 1.0507); | ||
return Mul(name, out, FloatOnnxConst({1.67326}, {1})); | ||
} |
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.
I would suggest using a flag, but probably doesn't make a difference. Better keep the Selu
operator unchanged and add an Elu
one, then make the change in the converter (with a comment).
#else | ||
|
||
bool GetLine(std::string& line) { | ||
return std::getline(std::cin, line); |
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.
This breaks the build, I think one solution is to change it to return !!std::getline(std::cin, line);
.
I was told this might be desirable. A couple things to note:
If anyone has any thoughts on whether this is warranted, I’d love to know! (Do let me know what you think!)
Some more technical details: This works by converting an Lc0 network to ONNX format (with
leela2onnx
) and then using the ORT‐web APIs to allow Lc0 to interface with the network through JavaScript.