Repository navigation
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
/diffusers-bot style |
|
Style bot fixed some files and pushed the changes. |
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks! just left some small questions
|
|
||
| if pkg_exists and import_name in _PKG_TO_DEPS_KEY: | ||
| requirement = Requirement(deps[_PKG_TO_DEPS_KEY[import_name]]) | ||
| if not requirement.specifier.contains(parse(pkg_version).base_version): |
There was a problem hiding this comment.
should we add a try ... except here?
| if is_accelerate_available(): | ||
| from accelerate import cpu_offload_with_hook | ||
| else: | ||
| raise ImportError("`enable_model_cpu_offload` requires `accelerate v0.17.0` or higher.") |
There was a problem hiding this comment.
ohh should we change the messages here too?
| if low_cpu_mem_usage is True and not is_torch_version(">=", "1.9.0"): | ||
| raise NotImplementedError( | ||
| "Low memory initialization requires torch >= 1.9.0. Please either update your PyTorch version or set" | ||
| " `low_cpu_mem_usage=False`." | ||
| ) |
|
|
||
| def forward(self, input) -> torch.Tensor: | ||
| return F.layer_norm(input, self.dim, self.weight, self.bias, self.eps) | ||
| LayerNorm = nn.LayerNorm |
There was a problem hiding this comment.
(nit): I guess we could just directly use the import here?
|
|
||
| if pkg_exists and import_name in _PKG_TO_DEPS_KEY: | ||
| requirement = Requirement(deps[_PKG_TO_DEPS_KEY[import_name]]) | ||
| if not requirement.specifier.contains(parse(pkg_version).base_version): |
There was a problem hiding this comment.
Could you add isolated availability tests for versions below, exactly at, and above each minimum, including local/dev version strings? This central check changes import routing for many optional backends, but the PR currently has no regression tests for those boundaries.
What does this PR do?
This PR
is_*_availablechecks to also account for the minimum supported version in our deps table. This prevents stuff like import issues when unsupported versions of optional libraries are installed in the env, e.g Fix model imports when torchao is older than 0.15 #15095Fixes # (issue)
Before submitting
self-reviewskill on the diff?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.