From e912a72032f06761d889f1eca84c6ac67c6e3459 Mon Sep 17 00:00:00 2001 From: Mengwei Liu Date: Wed, 17 Apr 2024 09:45:06 -0700 Subject: [PATCH 1/2] Fix llama2 README.md cmake instructions (#3096) Summary: As titled. The current instruction runs into issue due to our way of arranging `pthreadpool` and `cpuinfo` in CMake. Will need a bigger effort to clean them up. For now let's update the instruction to be able to run it. Differential Revision: D56251563 --- examples/models/llama2/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/models/llama2/README.md b/examples/models/llama2/README.md index d1a2550acf7..4448f1cba42 100644 --- a/examples/models/llama2/README.md +++ b/examples/models/llama2/README.md @@ -146,6 +146,7 @@ The Wikitext results generated above used: `{max_seq_len: 2048, limit: 1000}` -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ -DEXECUTORCH_BUILD_XNNPACK=ON \ -DEXECUTORCH_BUILD_OPTIMIZED=ON \ + -DEXECUTORCH_BUILD_CUSTOM=ON \ -Bcmake-out . cmake --build cmake-out -j16 --target install --config Release @@ -156,7 +157,9 @@ The Wikitext results generated above used: `{max_seq_len: 2048, limit: 1000}` cmake -DPYTHON_EXECUTABLE=python \ -DCMAKE_INSTALL_PREFIX=cmake-out \ -DCMAKE_BUILD_TYPE=Release \ + -DEXECUTORCH_BUILD_CUSTOM=ON \ -DEXECUTORCH_BUILD_OPTIMIZED=ON \ + -DEXECUTORCH_BUILD_XNNPACK=ON \ -Bcmake-out/examples/models/llama2 \ examples/models/llama2 From b24163582f541ace54539c3966188107623dad99 Mon Sep 17 00:00:00 2001 From: Mengwei Liu Date: Wed, 17 Apr 2024 09:45:06 -0700 Subject: [PATCH 2/2] Fix build time warning (#3097) Summary: tensor.data_ptr() is deprecated. To avoid warning change it to tensor.const_data_ptr() Differential Revision: D56251975 --- extension/evalue_util/print_evalue.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extension/evalue_util/print_evalue.cpp b/extension/evalue_util/print_evalue.cpp index ba6f92de8a5..efef4c414f5 100644 --- a/extension/evalue_util/print_evalue.cpp +++ b/extension/evalue_util/print_evalue.cpp @@ -149,12 +149,12 @@ void print_tensor(std::ostream& os, exec_aten::Tensor tensor) { // // TODO(T159700776): Format multidimensional data like numpy/PyTorch does. // https://github.com/pytorch/pytorch/blob/main/torch/_tensor_str.py -#define PRINT_TENSOR_DATA(ctype, dtype) \ - case ScalarType::dtype: \ - print_scalar_list( \ - os, \ - ArrayRef(tensor.data_ptr(), tensor.numel()), \ - /*print_length=*/false); \ +#define PRINT_TENSOR_DATA(ctype, dtype) \ + case ScalarType::dtype: \ + print_scalar_list( \ + os, \ + ArrayRef(tensor.const_data_ptr(), tensor.numel()), \ + /*print_length=*/false); \ break; switch (tensor.scalar_type()) {