Machine learning in trading: theory, models, practice and algo-trading - page 2966

 
Rorschach #:
Have you tried https://github.com/PINTO0309/json2onnx?

Thanks, I have. It's part of the big package simple-onnx-processing-tools(v1.1.16). I'm not that familiar with Python, so I couldn't get into it. Apparently this is a separate and not very simple topic. It takes time.

simple-onnx-processing-tools
  • 2023.03.15
  • pypi.org
A set of simple tools for splitting, merging, OP deletion, size compression, rewriting attributes and constants, OP generation, change opset, change to the specified input order, addition of OP, RGB to BGR conversion, change batch size, batch rename of OP, and JSON convertion for ONNX models.
 
Vladimir Perervenko #:

Thanks, I've seen it. It is part of the big package simple-onnx-processing-tools(v1.1.16). I'm not that familiar with Python, so I couldn't get into it. Apparently this is a separate and not very simple topic. It takes time.

I also came across such variants:

https://www.programmersought.com/article/33959514933/

https://github.com/onnx/onnx/issues/2456

 
Vladimir Perervenko #:

Thanks, I've seen it. It is part of the big package simple-onnx-processing-tools(v1.1.16). I'm not that familiar with Python, so I couldn't get into it. Apparently this is a separate and not very simple topic. It takes time.

Am I right to understand that there is nothing at all in R with conversion to ONNX? My searches in this direction did not lead to anything.

 

Forum on trading, automated trading systems and testing trading strategies

Conversation with artificial intelligence (AI) about forex.

Lilita Bogachkova, 2023.03.16 20:47

Can the ChatGPT generate R code to convert JSON to ONNX?

-

Yes, I can help generate R code to convert JSON to ONNX.

First, you will need to have the required R packages installed, including "jsonlite" and "onnx". You can install these packages using the following commands in R:

install.packages("jsonlite")
install.packages("onnx")

Assuming you have a JSON file with the data you want to convert to ONNX, you can use the following R code to load the JSON data, convert it to a data frame, and then convert it to ONNX:
library(jsonlite)
library(onnx)

#  Load the JSON data from file
json_data <- fromJSON("path/to/json/file.json")

#  Convert the JSON data to a data frame
df <- as.data.frame(json_data)

#  Convert the data frame to ONNX
onnx_model <- convertToONNX(df, "model_name")

#  Save the ONNX model to file
saveONNXModel(onnx_model, "path/to/onnx/model.onnx")

In the above code, replace "path/to/json/file.json" with the actual path to your JSON file, "model_name" with the name you want to give your ONNX model, and "path/to/onnx/model.onnx" with the desired path and file name for your ONNX model.

This code assumes that your JSON data is in a format that can be easily converted to a data frame, such as a JSON array of objects. If your JSON data is in a more complex format, you may need to do additional data manipulation before converting it to ONNX.


 
How childishly naive
 
Rorschach #:

Tell ChatGPT that the functions convertToONNX() and saveONNXModel() are not in the onnx package) Here is its description. ChatGPT will of course apologise and lie the next option) Already checked.

 
Aleksey Nikolayev #:

Tell ChatGPT that the functions convertToONNX() and saveONNXModel() are not in the onnx package) Here is its description. ChatGPT will of course apologise and lie the next option) Already checked.

In idea you can generalise the question or make it in several steps, but it's not for me, it's easier to search.


https://github.com/PINTO0309/json2onnx/blob/main/json2onnx/json2onnx.py

The basic code is kind of short

#  Convert JSON to onnx model
    onnx_str = json.dumps(json_file)
    onnx_graph = Parse(onnx_str, onnx.ModelProto())
 
Rorschach #:

Ideally you could generalise the question or make it into a few steps, but that's beyond me, it's easier to search.


https://github.com/PINTO0309/json2onnx/blob/main/json2onnx/json2onnx.py

The basic code is kind of short

It's python. My original question was about R.

 
The gulf in competence between people on the forum is so deep that some posts sound like mockery
 
Aleksey Nikolayev #:

It's python. My original question was about R.

I've basically started reversing the file format. Everything I've come across before says it's a json compressed protobuf. I just found this: "The ONNX-formatted model is a Protocol Buffers file, which is a message file format developed by Google"

Ускорение инференса модели BERT с помощью ONNX и ONNX Runtime на примере решения задачи классификации текста
Ускорение инференса модели BERT с помощью ONNX и ONNX Runtime на примере решения задачи классификации текста
  • 2022.12.12
  • habr.com
При обращении в Ростелеком каждый клиент преследует свою цель: узнать статус своей заявки, внести изменения в договор, сменить тарифный план, подключить телевидение и еще сотни уникальных потребностей клиента. При этом каждое обращение клиента необходимо достаточно быстро и с заданным уровнем качества автоматически идентифицировать для...