jrmccluskey commented on code in PR #24039:
URL: https://github.com/apache/beam/pull/24039#discussion_r1028381004
##########
sdks/python/apache_beam/ml/inference/tensorrt_inference.py:
##########
@@ -241,40 +297,7 @@ def run_inference(
Returns:
An Iterable of type PredictionResult.
"""
- from cuda import cuda
- (
- engine,
- context,
- context_lock,
- inputs,
- outputs,
- gpu_allocations,
- cpu_allocations,
- stream) = engine.get_engine_attrs()
-
- # Process I/O and execute the network
- with context_lock:
- _assign_or_fail(
- cuda.cuMemcpyHtoDAsync(
- inputs[0]['allocation'],
- np.ascontiguousarray(batch),
- inputs[0]['size'],
- stream))
- context.execute_async_v2(gpu_allocations, stream)
- for output in range(len(cpu_allocations)):
- _assign_or_fail(
- cuda.cuMemcpyDtoHAsync(
- cpu_allocations[output],
- outputs[output]['allocation'],
- outputs[output]['size'],
- stream))
- _assign_or_fail(cuda.cuStreamSynchronize(stream))
-
- return [
- PredictionResult(
- x, [prediction[idx] for prediction in cpu_allocations]) for idx,
- x in enumerate(batch)
- ]
+ return self.inference_fn(batch, engine, inference_args)
Review Comment:
Yeah the format is relatively simple, add a multiple to the original
prediction output and make sure we get the modified output. I've made a run at
it but my dev environment isn't meshing with the tests so it may take a few
iterations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]