Install torch version required by torch-mlir when setting up importer venv. (#486)

This commit is contained in:
Ean Garvey
2022-11-14 02:31:01 -06:00
committed by GitHub
parent d9f4a9954a
commit 45677c1e23
10 changed files with 15 additions and 11 deletions

View File

@@ -105,8 +105,6 @@ else
echo "Not installing a backend, please make sure to add your backend to PYTHONPATH"
fi
$PYTHON -m pip install -e . -f https://llvm.github.io/torch-mlir/package-index/ -f ${RUNTIME} -f https://download.pytorch.org/whl/nightly/torch/
if [[ ! -z "${IMPORTER}" ]]; then
echo "${Yellow}Installing importer tools.."
if [[ $(uname -s) = 'Linux' ]]; then
@@ -119,6 +117,9 @@ if [[ ! -z "${IMPORTER}" ]]; then
$PYTHON -m pip install --no-warn-conflicts --upgrade -r "$TD/requirements-importer-macos.txt" -f ${RUNTIME} --extra-index-url https://download.pytorch.org/whl/nightly/cpu
fi
fi
$PYTHON -m pip install --no-warn-conflicts -e . -f https://llvm.github.io/torch-mlir/package-index/ -f ${RUNTIME} -f https://download.pytorch.org/whl/nightly/torch/
if [[ $(uname -s) = 'Linux' && ! -z "${BENCHMARK}" ]]; then
$PYTHON -m pip uninstall -y torch torchvision
$PYTHON -m pip install --pre torch torchvision --extra-index-url https://download.pytorch.org/whl/nightly/cu116

View File

@@ -53,7 +53,7 @@ class BertModule(tf.Module):
bert_input, # inputs
tf.TensorSpec(shape=[BATCH_SIZE], dtype=tf.int32), # labels
],
jit_compile=True
jit_compile=True,
)
def forward(self, inputs, labels):
with tf.GradientTape() as tape:

View File

@@ -73,7 +73,7 @@ class BertModule(tf.Module):
bert_input, # inputs
tf.TensorSpec(shape=[BATCH_SIZE], dtype=tf.int32), # labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, inputs, labels):
with tf.GradientTape() as tape:

View File

@@ -61,7 +61,7 @@ class BertModule(tf.Module):
), # input2: segment_ids
tf.TensorSpec([BATCH_SIZE], tf.int32), # input3: labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, input_word_ids, input_mask, segment_ids, labels):
with tf.GradientTape() as tape:

View File

@@ -58,7 +58,7 @@ class BertModule(tf.Module):
bert_input, # inputs
tf.TensorSpec(shape=[BATCH_SIZE], dtype=tf.int32), # labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, inputs, labels):
with tf.GradientTape() as tape:

View File

@@ -51,7 +51,7 @@ class BertModule(tf.Module):
bert_input, # inputs
tf.TensorSpec(shape=[BATCH_SIZE], dtype=tf.int32), # labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, inputs, labels):
with tf.GradientTape() as tape:

View File

@@ -58,7 +58,7 @@ class BertModule(tf.Module):
), # input2: segment_ids
tf.TensorSpec([BATCH_SIZE], tf.int32), # input3: labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, input_word_ids, input_mask, segment_ids, labels):
with tf.GradientTape() as tape:

View File

@@ -54,7 +54,7 @@ class BertModule(tf.Module):
bert_input, # inputs
tf.TensorSpec(shape=[BATCH_SIZE], dtype=tf.int32), # labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, inputs, labels):
with tf.GradientTape() as tape:

View File

@@ -47,7 +47,7 @@ class BertModule(tf.Module):
bert_input, # inputs
tf.TensorSpec(shape=[BATCH_SIZE], dtype=tf.int32), # labels
],
jit_compile=True
jit_compile=True,
)
def learn(self, inputs, labels):
with tf.GradientTape() as tape:

View File

@@ -191,7 +191,10 @@ class ResNetModule(tf.Module):
self.m = tf_model
self.m.predict = lambda x: self.m.call(x, training=False)
@tf.function(input_signature=[tf.TensorSpec(INPUT_SHAPE, tf.float32)], jit_compile=True)
@tf.function(
input_signature=[tf.TensorSpec(INPUT_SHAPE, tf.float32)],
jit_compile=True,
)
def forward(self, inputs):
return self.m.predict(inputs)