mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-23 06:40:23 -07:00
* docs(M03): seed M03 plan and toolcalls Made-with: Cursor * ci: add repository guardrail, update CONTRIBUTING workflow Made-with: Cursor * M03: Test architecture (smoke/quality/nightly) - Move tests to test/smoke/, scaffold test/quality and test/nightly - Add pytest.ini with smoke/quality/nightly markers - Split CI: run_smoke_tests (PR), run_quality_tests (push main), run_nightly_tests (schedule) - Remove run_tests.yaml - Add prevent_upstream_push.sh pre-push hook template - Update CONTRIBUTING.md with hook install and test tier docs - Add repo and base-branch guardrails to workflows Made-with: Cursor * ci: remove obsolete warns_merge_master workflow (Serena uses main) Made-with: Cursor * fix: add base_url to pytest.ini for pytest-base-url plugin Made-with: Cursor * docs(M03): ledger, run1, audit, summary Made-with: Cursor * docs(M03): ledger commit 4ce5cde9 Made-with: Cursor
19 lines
473 B
Python
19 lines
473 B
Python
import types
|
|
|
|
import pytest
|
|
import torch
|
|
|
|
from modules import torch_utils
|
|
|
|
|
|
@pytest.mark.parametrize("wrapped", [True, False])
|
|
def test_get_param(wrapped):
|
|
mod = torch.nn.Linear(1, 1)
|
|
cpu = torch.device("cpu")
|
|
mod.to(dtype=torch.float16, device=cpu)
|
|
if wrapped:
|
|
# more or less how spandrel wraps a thing
|
|
mod = types.SimpleNamespace(model=mod)
|
|
p = torch_utils.get_param(mod)
|
|
assert p.dtype == torch.float16
|
|
assert p.device == cpu
|