Skip to content

Instantly share code, notes, and snippets.

@wangkuiyi
wangkuiyi / github_get_repo.py
Created July 27, 2023 20:36
get_repo for GitHub (Enterprise) using requests
import requests
import os
from pprint import pprint
# The GitHub API get_repo
# - for Free/Pro/Teams: https://docs.github.com/en/free-pro-team@latest/rest/repos/repos?apiVersion=2022-11-28#get-a-repository
# - for Enterprise/Cloud: https://docs.github.com/en/enterprise-cloud@latest/rest/repos/repos?apiVersion=2022-11-28#get-a-repository
#
token = os.getenv('GITHUB_TOKEN')
owner = "ywang999828"
(ajax) ✔ ~/w/iree-jax [main|✔]
19:53 $ python3 models/gpt2/export.py
I0423 19:54:00.877818 8498699072 xla_bridge.py:170] Remote TPU is not linked into jax; skipping remote TPU.
I0423 19:54:00.877909 8498699072 xla_bridge.py:353] Unable to initialize backend 'tpu_driver': Could not initialize backend 'tpu_driver'
I0423 19:54:00.877947 8498699072 xla_bridge.py:353] Unable to initialize backend 'cuda': module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'
I0423 19:54:00.877974 8498699072 xla_bridge.py:353] Unable to initialize backend 'rocm': module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'
I0423 19:54:00.878067 8498699072 xla_bridge.py:353] Unable to initialize backend 'tpu': module 'jaxlib.xla_extension' has no attribute 'get_tpu_client'
I0423 19:54:00.878116 8498699072 xla_bridge.py:353] Unable to initialize backend 'plugin': xla_extension has no attributes named get_plugin_device_client. Compile TensorFlow with //tensorflow/compiler/xla/python:enable_plugin_device set to true
# Copyright 2023 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.21...3.24)
project(IREE_RUNTIME_LIBRARY)
cmake_policy(SET CMP0069 NEW)
digraph G {
node [shape=rect];
jax [label="JAX program in Python"];
jaxpr [label="JAXPR"];
pytorch [label="PyTorch program in Python"];
fxgraph [label="torch.fx.Graph"];
stablehlo [label="StableHLO semantics\nin MLIR source file.\nLooks like Fortran code"];
section [label="Dispatch sections\nin StableHLO semantics.\nEach compiled into a kernel"];
Undefined symbols for architecture arm64:
1200 "___tsan_func_entry", referenced from:
_encode_dispatch_0_generic_8 in gpt2_module_linked_llvm_cpu-dff9a6.o
_encode_dispatch_1_generic_8 in gpt2_module_linked_llvm_cpu-dff9a6.o
_encode_dispatch_2_generic_8x768 in gpt2_module_linked_llvm_cpu-dff9a6.o
_encode_dispatch_3_generic_8x768 in gpt2_module_linked_llvm_cpu-dff9a6.o
_encode_dispatch_4_generic_8x768 in gpt2_module_linked_llvm_cpu-dff9a6.o
_encode_dispatch_5_generic_768x8 in gpt2_module_linked_llvm_cpu-dff9a6.o
_encode_dispatch_6_matmul_2304x8x768 in gpt2_module_linked_llvm_cpu-dff9a6.o
...
2023-02-26 21:20:12.000373-0800 IREESampleApp[3010:965631] Metal GPU Frame Capture Enabled
2023-02-26 21:20:12.000497-0800 IREESampleApp[3010:965631] Metal API Validation Enabled
2023-02-26 21:20:12.793190-0800 IREESampleApp[3010:965631] Succeeded init GPT2
Thread Performance Checker: Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions
PID: 3010, TID: 965631
Backtrace
=================================================================
3 IREESampleApp 0x00000001047a9ed4 iree_hal_metal_shared_event_wait + 552
4 IREESampleApp 0x000000010472b584 iree_hal_semaphore_wait + 120
5 IREESampleApp 0x000000010472b904 iree_hal_semaphore_list_wait + 132
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
Looking in indexes: https://pypi.apple.com/simple
Requirement already satisfied: pip>=21.3 in /Users/y/miniforge3/envs/iree-jax/lib/python3.10/site-packages (from -r /Users/y/w/iree-ios/iree/runtime/bindings/python/iree/runtime/build_requirements.txt (line 6)) (22.3.1)
Requirement already satisfied: setuptools>=62.4.0 in /Users/y/miniforge3/envs/iree-jax/lib/python3.10/site-packages (from -r /Users/y/w/iree-ios/iree/runtime/bindings/python/iree/runtime/build_requirements.txt (line 7)) (66.1.1)
Requirement already satisfied: numpy>=1.19.4 in /Users/y/miniforge3/envs/iree-jax/lib/python3.10/site-packages (from -r /Users/y/w/iree-ios/iree/runtime/bindings/python/iree/runtime/build_requirements.txt (line 8)) (1.24.1)
Requirement already satisfied: pybind11>=2.10.1 in /Users/y/miniforge3/envs/iree-jax/lib/python3.10/site-packages (from -r /Users/y/w/iree-ios/iree/runtime/bindings/python/iree/runtime/build_requirements.txt (line 9)) (2.10.3)
Requirement already satisfied: requests>=2.28.0 in /Users/y/miniforge3/env
09:56 $ python model.py | iree-compile - --iree-hal-target-backends=llvm-cpu --iree-input-type=mhlo --iree-mhlo-demote-i64-to-i32=false > /tmp/x.vmfb
<stdin>:1226:13: error: 'iree_linalg_ext.scatter' op indexed shape of update value dim#1 exceeds original value at dim#0 64 -9223372036854775808
%1181 = "stablehlo.scatter"(%1180, %1165, %1178) ({
^
<stdin>:21:12: note: called from
%8:5 = call @jit__train_step_kernel$main(%arg0, %arg1, %0, %1, %2, %3, %4, %5, %6, %7) : (tensor<512x19xi64>, tensor<512xi64>, tensor<1000000xf32>, tensor<1000000xf32>, tensor<1000000xf32>, tensor<2xui32>, tensor<681022xi64>, tensor<11xi64>, tensor<256xi64>, tensor<256xi64>) -> (tensor<1000000xf32>, tensor<1000000xf32>, tensor<1000000xf32>, tensor<2xui32>, tensor<f32>)
^
<stdin>:1226:13: note: see current operation:
%19 = "iree_linalg_ext.scatter"(%0, %5, %18) ({
^bb0(%arg3: f32, %arg4: f32):