You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.9 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Load and Run
  2. Load a model and run, for testing/debugging/profiling.
  3. ## Build
  4. <!--
  5. -->
  6. ### Build with cmake
  7. Build MegEngine from source following [README.md](../../README.md). It will also produce the executable, `load_and_run`, which loads a model and runs the test cases attached to the model.
  8. <!--
  9. -->
  10. ## Dump Model with Test Cases Using [dump_with_testcase_mge.py](dump_with_testcase_mge.py)
  11. ### Step 1
  12. Dump the model by calling the python API `megengine.jit.trace.dump()`.
  13. ### Step 2
  14. Append the test cases to the dumped model using [dump_with_testcase_mge.py](dump_with_testcase_mge.py).
  15. The basic usage of [dump_with_testcase_mge.py](dump_with_testcase_mge.py) is
  16. ```
  17. python3 dump_with_testcase_mge.py model -d input_description -o model_with_testcases
  18. ```
  19. where `model` is the file dumped at step 1, `input_description` describes the input data of the test cases, and `model_with_testcases` is the saved model with test cases.
  20. `input_description` can be provided in the following ways:
  21. 1. In the format `var0:file0;var1:file1...` meaning that `var0` should use
  22. image file `file0`, `var1` should use image `file1` and so on. If there
  23. is only one input var, the var name can be omitted. This can be combined
  24. with `--resize-input` option.
  25. 2. In the format `var0:#rand(min, max, shape...);var1:#rand(min, max)...`
  26. meaning to fill the corresponding input vars with uniform random numbers
  27. in the range `[min, max)`, optionally overriding its shape.
  28. For more usages, run
  29. ```
  30. python3 dump_with_testcase_mge.py --help
  31. ```
  32. ### Example
  33. 1. Obtain the model file by running [xornet.py](../xor-deploy/xornet.py).
  34. 2. Dump the file with test cases attached to the model.
  35. ```
  36. python3 dump_with_testcase_mge.py xornet_deploy.mge -o xornet.mge -d "#rand(0.1, 0.8, 4, 2)"
  37. ```
  38. 3. Verify the correctness by running `load_and_run` at the target platform.
  39. ```
  40. load_and_run xornet.mge
  41. ```

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台

Contributors (1)