Skip to content

Commit

Permalink
Merge pull request #1466 from shrinath-suresh/kservev2-regression-tes…
Browse files Browse the repository at this point in the history
…t-fix

Kservev2 regression test fix
  • Loading branch information
lxning authored Feb 25, 2022
2 parents 162af4f + d1a7b8b commit ff4d90b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion kubernetes/kserve/image_transformer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The request first comes to the image transformer at port 8080 and in turn reques
- The curl request for inference is as below:

```
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/mnist.json http://0.0.0.0:8080/v1/models/mnist:predict
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/v1/mnist.json http://0.0.0.0:8080/v1/models/mnist:predict
```

output:
Expand Down
14 changes: 7 additions & 7 deletions kubernetes/kserve/kserve_wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ For v1 protocol
The curl request for inference is as below:

```bash
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/mnist.json http://0.0.0.0:8080/v1/models/mnist:predict
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/v1/mnist.json http://0.0.0.0:8080/v1/models/mnist:predict
```

Output:
Expand All @@ -134,7 +134,7 @@ Output:
The curl request for explain is as below:

```
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/mnist.json http://0.0.0.0:8080/v1/models/mnist:explain
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/v1/mnist.json http://0.0.0.0:8080/v1/models/mnist:explain
```

Output:
Expand Down Expand Up @@ -176,7 +176,7 @@ Response:
The curl request for explain is as below:

```
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/mnist.json http://0.0.0.0:8080/v2/models/mnist/explain
curl -H "Content-Type: application/json" --data @serve/kubernetes/kserve/kf_request_json/v1/mnist.json http://0.0.0.0:8080/v2/models/mnist/explain
```

Response:
Expand Down Expand Up @@ -238,25 +238,25 @@ For v1 protocol
The curl request for inference is as below:

```bash
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/bert.json http://0.0.0.0:8080/v1/models/bert:predict
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/v1/bert.json http://0.0.0.0:8080/v1/models/bert:predict
```

The curl request for Explain is as below:

```bash
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/bert.json http://0.0.0.0:8080/v1/models/bert:explain
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/v1/bert.json http://0.0.0.0:8080/v1/models/bert:explain
```

For v2 protocol

The curl request for inference is as below:

```bash
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/bert.json http://0.0.0.0:8080/v2/models/bert/infer
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/v1/bert.json http://0.0.0.0:8080/v2/models/bert/infer
```

The curl request for Explain is as below:

```bash
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/bert.json http://0.0.0.0:8080/v2/models/bert/explain
curl -H "Content-Type: application/json" --data @kubernetes/kserve/kf_request_json/v1/bert.json http://0.0.0.0:8080/v2/models/bert/explain
```
4 changes: 2 additions & 2 deletions test/postman/kf_https_test_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
"body": {
"mode": "file",
"file": {
"src": "../kubernetes/kserve/kf_request_json/mnist.json"
"src": "../kubernetes/kserve/kf_request_json/v1/mnist.json"
},
"options": {
"raw": {
Expand Down Expand Up @@ -355,7 +355,7 @@
"body": {
"mode": "file",
"file": {
"src": "../kubernetes/kserve/kf_request_json/mnist.json"
"src": "../kubernetes/kserve/kf_request_json/v1/mnist.json"
},
"options": {
"raw": {
Expand Down
2 changes: 1 addition & 1 deletion test/postman/kf_inference_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"model_name":"mnist",
"worker":1,
"synchronous":"true",
"file":"../kubernetes/kserve/kf_request_json/mnist.json",
"file":"../kubernetes/kserve/kf_request_json/v1/mnist.json",
"content-type":"application/json",
"expected":{
"predictions": [
Expand Down
4 changes: 2 additions & 2 deletions test/postman/kfv2_https_test_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
"body": {
"mode": "file",
"file": {
"src": "../kubernetes/kserve/kf_request_json/mnist_v2.json"
"src": "../kubernetes/kserve/kf_request_json/v2/mnist/mnist_v2_tensor.json"
},
"options": {
"raw": {
Expand Down Expand Up @@ -347,7 +347,7 @@
"body": {
"mode": "file",
"file": {
"src": "../kubernetes/kserve/kf_request_json/mnist_v2.json"
"src": "../kubernetes/kserve/kf_request_json/v2/mnist/mnist_v2_tensor.json"
},
"options": {
"raw": {
Expand Down
2 changes: 1 addition & 1 deletion test/postman/kfv2_inference_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"model_name": "mnist",
"worker": 1,
"synchronous": "true",
"file": "../kubernetes/kserve/kf_request_json/mnist_v2.json",
"file": "../kubernetes/kserve/kf_request_json/v2/mnist/mnist_v2_tensor.json",
"content-type": "application/json",
"expected": {
"id":"d3b15cad-50a2-4eaf-80ce-8b0a428bd298","model_name":"mnist","model_version":"1.0","outputs":[{"name":"predict","shape":[],"datatype":"INT64","data":[1]}]
Expand Down
8 changes: 4 additions & 4 deletions test/pytest/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
snapshot_file_kf = os.path.join(REPO_ROOT,"test/config_kf.properties")
snapshot_file_tf = os.path.join(REPO_ROOT,"test/config_ts.properties")
data_file_mnist = os.path.join(REPO_ROOT, 'examples/image_classifier/mnist/test_data/1.png')
input_json_mnist = os.path.join(REPO_ROOT, "kubernetes/kserve/kf_request_json/mnist.json")
input_json_mnist = os.path.join(REPO_ROOT, "kubernetes/kserve/kf_request_json/v1/mnist.json")
input_json_mmf = os.path.join(REPO_ROOT, "examples/MMF-activity-recognition/372CC.info.json")

def getAPIS(snapshot_file):
Expand Down Expand Up @@ -202,7 +202,7 @@ def test_kserve_mnist_model_register_scale_inference_with_non_existent_handler(
data = json.loads(s)

response = run_inference_using_url_with_data_json(KF_INFERENCE_API + '/v1/models/mnist:predict', data)

if response is None:
assert True, "Inference failed as the handler is non existent"
else:
Expand Down Expand Up @@ -240,7 +240,7 @@ def test_huggingface_bert_batch_inference():
test_utils.start_torchserve(no_config_snapshots=True)
test_utils.register_model_with_params(params)
input_text = os.path.join(REPO_ROOT, 'examples/Huggingface_Transformers/Seq_classification_artifacts/sample_text.txt')

# Make 2 curl requests in parallel with &
# curl --header \"X-Forwarded-For: 1.2.3.4\" won't work since you can't access local host anymore
response = os.popen(f"curl http://127.0.0.1:8080/predictions/BERTSeqClassification -T {input_text} & curl http://127.0.0.1:8080/predictions/BERTSeqClassification -T {input_text}")
Expand All @@ -253,7 +253,7 @@ def test_huggingface_bert_batch_inference():

@pytest.mark.skip(reason="MMF doesn't support PT 1.10 yet")
def test_MMF_activity_recognition_model_register_and_inference_on_valid_model():

test_utils.start_torchserve(snapshot_file = snapshot_file_tf)
test_utils.register_model('MMF_activity_recognition_v2', 'https://torchserve.pytorch.org/mar_files/MMF_activity_recognition_v2.mar')
os.system('wget https://mmfartifacts.s3-us-west-2.amazonaws.com/372CC.mp4 -P ../../examples/MMF-activity-recognition')
Expand Down

0 comments on commit ff4d90b

Please sign in to comment.