Skip to content

Commit

Permalink
Tensorflow check and extras README (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
swashko authored Apr 11, 2024
1 parent 2f2b024 commit 022985e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pip install modelscan
With it installed, scan a model:

```bash
modelscan -p /path/to/model_file.h5
modelscan -p /path/to/model_file.pkl
```

## Why You Should Scan Models
Expand Down Expand Up @@ -105,6 +105,11 @@ or `pyproject.toml` like this:
modelscan = ">=0.1.1"
```

Scanners for Tensorflow or HD5 formatted models require installation with extras:
```bash
pip install 'modelscan[ tensorflow, h5py ]'
```

### Using ModelScan via CLI

ModelScan supports the following arguments via the CLI:
Expand Down
4 changes: 3 additions & 1 deletion modelscan/scanners/saved_model/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def _check_for_unsafe_tf_keras_operator(
unsafe_operators: Dict[str, Any],
) -> ScanResults:
issues: List[Issue] = []
all_operators = tensorflow.raw_ops.__dict__.keys()
all_operators = (
tensorflow.raw_ops.__dict__.keys() if tensorflow_installed else []
)
all_safe_operators = [
operator for operator in list(all_operators) if operator[0] != "_"
]
Expand Down

0 comments on commit 022985e

Please sign in to comment.