Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stable diffusion signature with more parameters #362

Merged
merged 9 commits into from
Oct 11, 2023

Conversation

spillai
Copy link
Contributor

@spillai spillai commented Sep 30, 2023

  • parameter validation only checks if parameter subsets are provided (not fully specified)
  • updated model spec to allow '.' and '_' in addition to / and - in parameter names
  • no need to update SD tests to reflect new parameter signature
  • fix client-side message length option default GRPC_MAX_MESSAGE_LENGTH to 32MB

Summary

Related issues

Checks

  • make lint: I've run make lint to lint the changes in this PR.
  • make test: I've made sure the tests (make test-cpu or make test) are passing.
  • Additional tests:
    • Benchmark tests (when contributing new models)
    • GPU/HW tests

@spillai spillai added the feature New feature or request label Sep 30, 2023
@spillai spillai self-assigned this Sep 30, 2023
@spillai
Copy link
Contributor Author

spillai commented Sep 30, 2023

FYI @outtanames this might break pixeltable SD integration since defaults are not relayed via the GetModelInfo(). Setting label to do-not-merge for now

@spillai spillai force-pushed the spillai/0.0.11-sd-parameter-signature branch 3 times, most recently from eba719d to 5fa07cc Compare October 5, 2023 17:57
- parameter validation only checks if parameter subsets are provided (not fully specified)
- updated model spec to allow '.' and '_' in addition to `/` and `-` in parameter names
- no need to update SD tests to reflect new parameter signature
- fix client-side message length option default `GRPC_MAX_MESSAGE_LENGTH` to 32MB
 - packages include torch_tensorrt, torch_neuron, torch_neuronx
 - moved `NOS_RAY_*` constants to `nos.constants`
 - moved stable diffusion neuron model to `autonomi.nos._internal`
@spillai spillai force-pushed the spillai/0.0.11-sd-parameter-signature branch from a8f0847 to a39c105 Compare October 11, 2023 03:52
@spillai spillai merged commit cfddcb7 into main Oct 11, 2023
5 checks passed
@spillai spillai deleted the spillai/0.0.11-sd-parameter-signature branch October 11, 2023 04:02
spillai added a commit that referenced this pull request Oct 16, 2023
## Summary

This PR makes a significant update to the core API that simplifies the
need to specify TaskType's in every `Run()` call and also supports
multiple methods for any wrapped Model.

**Key Features:** 
 - Updated `Run()` to remove the need to specify `TaskType`s

```python
# Old `Run()` implementation
client.Run(task=TaskType.IMAGE_EMBEDDING, model_name="openai/clip")

# New `Run()` implementation (wraps `__call__`)
client.Run("yolox/yolox-medium", inputs={...})
# New `Run()` implementation with custom methods (wraps `encode_image`)
client.Run("openai/clip", inputs={...}, method="encode_image")
```

- Patch `ModelHandle` with additional methods that may be implemented
(`forward`, `encode_text`, `encode_image` ). This allows us remotely
execute model methods with a familiar API. In addition, we support
`ModelHandlePartial` objects to also allow for async submissions of
specific methods.
 submisions for a specific method.

```python
spec: ModelSpec = hub.load_spec("openai/clip")
handle: ModelHandle = manager.load(spec)

# New methods automatically patched
img_embeddings = handle.encode_image(...)
txt_embeddings = handle.encode_image(...)

# ModelHandlePartials allow us to make async `submit()` calls via:

# Async submission of image encoding
handle.encode_image.submit(...)
```
 - `ModelHandlePartial` now enables the following
- `handle.encode_image` is actually a `ModelHandlePartial` that wraps
`handle.__call__(..., _method="encode_image")` through it's `__call__`
method.
- `handle.encode_image.submit` wraps the `handle.submit(...,
_method="encode_image")` method.

- `Module` interface now supports multiple methods that are dynamically
patched that is automatically inspected.
- `FunctionSignature` now supports multiple signature methods and
metadata (tasks, model resources now are defined here).

**Tests**
 - added checks in `test_hub.py` to test for model info and metadata
Fully functional ModelHandlePartial impl with multiple method signatures
- adds tests for `ModelHandle` and `ModelHandlePartial`s to call custom
methods including `__call__` and `submit()`
 - Added tests for multiple signatures and default signatures/methods.
- Added / updated and working tests for `hub`, `common`, `executor` and
`manager`


## Related issues
Resolves #366 #368 #369 #370 #362 

## Checks

- [x] `make lint`: I've run `make lint` to lint the changes in this PR.
- [x] `make test`: I've made sure the tests (`make test-cpu` or `make
test`) are passing.
- Additional tests:
   - [ ] Benchmark tests (when contributing new models)
   - [ ] GPU/HW tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant