ci : bump ty to 0.0.78 (#28548)
* bump ty to 0.0.78 * type fixes * more type fixes * add --exit-zero-on-warning * remove Callable again
This commit is contained in:
@@ -31,7 +31,7 @@ jobs:
|
|||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
pip-install: -r requirements/requirements-all.txt ty==0.0.35
|
pip-install: -r requirements/requirements-all.txt ty==0.0.78
|
||||||
# - name: Type-check with Pyright
|
# - name: Type-check with Pyright
|
||||||
# uses: jakebailey/pyright-action@v2
|
# uses: jakebailey/pyright-action@v2
|
||||||
# with:
|
# with:
|
||||||
@@ -40,4 +40,4 @@ jobs:
|
|||||||
# warnings: true
|
# warnings: true
|
||||||
- name: Type-check with ty
|
- name: Type-check with ty
|
||||||
run: |
|
run: |
|
||||||
ty check --output-format=github
|
ty check --exit-zero-on-warning --output-format=github
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class MiniMaxText01Model(TextModel):
|
|||||||
# they get in the way of the token sampling process and must be suppressed
|
# they get in the way of the token sampling process and must be suppressed
|
||||||
|
|
||||||
tokenizer = AutoTokenizer.from_pretrained(self.dir_model, trust_remote_code=True)
|
tokenizer = AutoTokenizer.from_pretrained(self.dir_model, trust_remote_code=True)
|
||||||
tokenizer_vocab_size = tokenizer.vocab_size
|
tokenizer_vocab_size = tokenizer.vocab_size # ty: ignore[unresolved-attribute]
|
||||||
|
|
||||||
with open(self.dir_model / "model.safetensors.index.json", "r", encoding="utf-8") as f:
|
with open(self.dir_model / "model.safetensors.index.json", "r", encoding="utf-8") as f:
|
||||||
weight_map = json.load(f)["weight_map"]
|
weight_map = json.load(f)["weight_map"]
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MuseGlimmerModel(TextModel):
|
|||||||
|
|
||||||
from transformers import AutoTokenizer
|
from transformers import AutoTokenizer
|
||||||
tok = AutoTokenizer.from_pretrained(self.dir_model)
|
tok = AutoTokenizer.from_pretrained(self.dir_model)
|
||||||
eot_id = tok.convert_tokens_to_ids("<|eot|>")
|
eot_id = tok.convert_tokens_to_ids("<|eot|>") # ty: ignore[unresolved-attribute]
|
||||||
if isinstance(eot_id, int) and eot_id >= 0:
|
if isinstance(eot_id, int) and eot_id >= 0:
|
||||||
self.gguf_writer.add_eot_token_id(eot_id)
|
self.gguf_writer.add_eot_token_id(eot_id)
|
||||||
|
|
||||||
|
|||||||
@@ -1177,7 +1177,7 @@ def create_dynamic_model_from_function(func: Callable[..., Any]):
|
|||||||
dynamic_fields[param.name] = (
|
dynamic_fields[param.name] = (
|
||||||
param.annotation if param.annotation != inspect.Parameter.empty else str, default_value)
|
param.annotation if param.annotation != inspect.Parameter.empty else str, default_value)
|
||||||
# Creating the dynamic model
|
# Creating the dynamic model
|
||||||
dynamic_model = create_model(f"{getattr(func, '__name__')}", **dynamic_fields)
|
dynamic_model = create_model(f"{getattr(func, '__name__')}", **dynamic_fields) # ty: ignore[no-matching-overload]
|
||||||
|
|
||||||
for name, param_doc in param_docs:
|
for name, param_doc in param_docs:
|
||||||
dynamic_model.model_fields[name].description = param_doc.description
|
dynamic_model.model_fields[name].description = param_doc.description
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ from PySide6.QtCore import Qt, QRect, QSize
|
|||||||
from jinja2 import TemplateSyntaxError
|
from jinja2 import TemplateSyntaxError
|
||||||
from jinja2.sandbox import ImmutableSandboxedEnvironment
|
from jinja2.sandbox import ImmutableSandboxedEnvironment
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
|
|
||||||
def format_template_content(template_content):
|
def format_template_content(template_content):
|
||||||
@@ -396,7 +395,7 @@ class JinjaTester(QMainWindow):
|
|||||||
ensure_ascii=ensure_ascii,
|
ensure_ascii=ensure_ascii,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
env.globals["strftime_now"]: Callable[[str], str] = lambda format: datetime.now().strftime(format)
|
env.globals["strftime_now"] = lambda format: datetime.now().strftime(format) # ty: ignore[invalid-assignment, invalid-argument-type]
|
||||||
env.globals["raise_exception"] = raise_exception # ty: ignore[invalid-assignment]
|
env.globals["raise_exception"] = raise_exception # ty: ignore[invalid-assignment]
|
||||||
try:
|
try:
|
||||||
template = env.from_string(template_str)
|
template = env.from_string(template_str)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import argparse
|
|||||||
import statistics
|
import statistics
|
||||||
import logging
|
import logging
|
||||||
import bisect
|
import bisect
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional, Iterable
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
@@ -473,6 +473,8 @@ def print_bubbles_timeline(op):
|
|||||||
all_bubbles = []
|
all_bubbles = []
|
||||||
for t in active_threads:
|
for t in active_threads:
|
||||||
stats = thread_stats[t]
|
stats = thread_stats[t]
|
||||||
|
assert isinstance(stats['dma_bubbles'], Iterable)
|
||||||
|
assert isinstance(stats['compute_bubbles'], Iterable)
|
||||||
for start, end, dur in stats['compute_bubbles']:
|
for start, end, dur in stats['compute_bubbles']:
|
||||||
pct = (dur / batch_duration) * 100.0
|
pct = (dur / batch_duration) * 100.0
|
||||||
all_bubbles.append((dur, f"Thread {t} Compute: bubble of {dur} cycles ({pct:.1f}%) at {start - op_start} to {end - op_start}"))
|
all_bubbles.append((dur, f"Thread {t} Compute: bubble of {dur} cycles ({pct:.1f}%) at {start - op_start} to {end - op_start}"))
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ import typer
|
|||||||
|
|
||||||
sys.path.insert(0, Path(__file__).parent.parent.as_posix())
|
sys.path.insert(0, Path(__file__).parent.parent.as_posix())
|
||||||
if True:
|
if True:
|
||||||
from tools.server.tests.utils import ServerProcess
|
from tools.server.tests.utils import ServerProcess # ty: ignore[unresolved-import]
|
||||||
from tools.server.tests.unit.test_tool_call import do_test_calc_result, do_test_hello_world, do_test_weather
|
from tools.server.tests.unit.test_tool_call import do_test_calc_result, do_test_hello_world, do_test_weather # ty: ignore[unresolved-import]
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|||||||
Reference in New Issue
Block a user