Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e84ff277e |
No files matched your search
@@ -44,7 +44,6 @@ Heretic can, depending on the configuration:
|
||||
* Reduce humor ([`config.nohumor.toml`](/config.nohumor.toml))
|
||||
* Reduce sycophancy ([`config.nosyco.toml`](/config.nosyco.toml))
|
||||
* Alter emotional alignment ([`config.emotions.toml`](/config.emotions.toml))
|
||||
* Shorten response length ([`config.terse.toml`](/config.terse.toml))
|
||||
|
||||
and many, many other things.
|
||||
|
||||
@@ -62,8 +61,8 @@ Heretic models have been independently benchmarked using standard metrics
|
||||
like MMLU and GSM8K, and have been found to compare favorably against models
|
||||
produced with competing abliteration tools.[^2][^3]
|
||||
|
||||
[^2]: [Qwen2.5-7B: Three-Way Abliteration Comparison](https://huggingface.co/DreamFast/Qwen-2.5-7b-abliterlitics): *"Heretic is the most surgical and most effective."*
|
||||
[^3]: [Gemma 4 E4B: 23 Abliteration Variants Compared](https://huggingface.co/DreamFast/Gemma4-e4b-abliterlitics): *"Best overall: heretic."*
|
||||
[^2]: https://old.reddit.com/r/LocalLLaMA/comments/1sojjoc/abliterlitics_benchmark_and_tensor_analysis/
|
||||
[^3]: https://old.reddit.com/r/LocalLLaMA/comments/1sy18lx/abliterlitics_benchmarks_and_tensor_comparison/
|
||||
|
||||
|
||||
|
||||
@@ -229,11 +228,10 @@ exists on Hugging Face.
|
||||
Unlike lots of AI-related software today (and indeed lots of software in general),
|
||||
Heretic is **not** "vibe-coded".
|
||||
|
||||
All of [my](https://github.com/p-e-w) commits to this project until November 2026
|
||||
were written 100% by hand, the way I have been doing programming for decades.
|
||||
I have been using LLM assistance *very* sparingly since. While many Heretic contributors
|
||||
use coding agents, I carefully review every single line of code that I merge.
|
||||
There's no "LGTM" here!
|
||||
All of [my](https://github.com/p-e-w) commits in this project so far were written
|
||||
100% by hand, the way I have been doing programming for decades, and while some
|
||||
Heretic contributors use coding agents, I review every single line of code that I
|
||||
merge very carefully. There's no "LGTM" here!
|
||||
|
||||
Don't believe me? Check out [this pull request](https://github.com/p-e-w/heretic/pull/53),
|
||||
which accumulated **almost 350 human-written comments** over more than 7 months
|
||||
@@ -241,8 +239,8 @@ as we discussed the implementation.
|
||||
And [here is another PR](https://github.com/p-e-w/heretic/pull/191) with
|
||||
**more than 200 comments.**
|
||||
|
||||
I am the opposite of a luddite and I have used agents liberally for other projects,
|
||||
but I am proud of the code I write and so far can't quite bring myself to let a machine
|
||||
I am the opposite of a luddite and I have used agents for other projects, but
|
||||
I am proud of the code I write and so far can't quite bring myself to let a machine
|
||||
write it for me in a project I care so much about. As a result, Heretic has a lean,
|
||||
relatively simple codebase that in my opinion, and in that of some others,
|
||||
is a pleasure to work on.
|
||||
|
||||
@@ -112,10 +112,6 @@ upload_tags = [
|
||||
# System prompt to use when prompting the model.
|
||||
system_prompt = "You are a helpful assistant."
|
||||
|
||||
# Whether to offer the option to open an in-context Python shell in the trial selection menu.
|
||||
# WARNING: Enabling this feature gives full system access to the user of the Heretic session.
|
||||
enable_shell = false
|
||||
|
||||
# Dataset of prompts to use for automatically determining the optimal batch size.
|
||||
[batch_size_test_prompts]
|
||||
dataset = "mlabonne/harmless_alpaca"
|
||||
@@ -296,9 +292,6 @@ task = "piqa"
|
||||
# Task metric to use as the benchmark score.
|
||||
metric = "acc_norm,none"
|
||||
|
||||
# Number of input sequences to process in parallel (0 = auto).
|
||||
batch_size = 0 # auto
|
||||
|
||||
|
||||
[scorer.ResponseLength]
|
||||
# Whether to strip leading and trailing whitespace from responses before measuring their length.
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "heretic-llm"
|
||||
version = "2.2.0.dev0"
|
||||
version = "2.1.0.dev0"
|
||||
description = "Training-free language model modification"
|
||||
readme = "README.md"
|
||||
license = "AGPL-3.0-or-later"
|
||||
@@ -29,7 +29,6 @@ dependencies = [
|
||||
"datasets~=5.0",
|
||||
"huggingface-hub~=1.33",
|
||||
"immutabledict~=4.3",
|
||||
"ipython~=8.39",
|
||||
"langdetect~=1.0",
|
||||
"lm-eval[hf]~=0.4",
|
||||
"numpy~=2.2",
|
||||
|
||||
@@ -575,15 +575,6 @@ class Settings(BaseSettings):
|
||||
description="System prompt to use when prompting the model.",
|
||||
)
|
||||
|
||||
enable_shell: bool = Field(
|
||||
default=False,
|
||||
description=(
|
||||
"Whether to offer the option to open an in-context Python shell in the trial selection menu. "
|
||||
"WARNING: Enabling this feature gives full system access to the user of the Heretic session."
|
||||
),
|
||||
exclude=True,
|
||||
)
|
||||
|
||||
# We intentionally allow extra keys so users can provide plugin-specific
|
||||
# configuration in TOML tables like `[scorer.KeywordRate]` which are later
|
||||
# consumed via `settings.model_extra` (see `plugin.get_plugin_namespace`).
|
||||
|
||||
@@ -230,10 +230,3 @@ class Evaluator:
|
||||
parse_study_direction(entry.config.optimization)
|
||||
for entry in self._objective_entries()
|
||||
]
|
||||
|
||||
def write_settings_to_config(self) -> None:
|
||||
"""
|
||||
Write the settings of all scorers to the global configuration.
|
||||
"""
|
||||
for entry in self._scorer_entries:
|
||||
entry.scorer.write_settings_to_config("scorer", entry.config.instance_name)
|
||||
+14
-97
@@ -60,12 +60,10 @@ from pathlib import Path
|
||||
from typing import Any, cast
|
||||
|
||||
import huggingface_hub
|
||||
import IPython
|
||||
import lm_eval
|
||||
import numpy as np
|
||||
import optuna
|
||||
import questionary
|
||||
import rich.traceback
|
||||
import torch
|
||||
import transformers
|
||||
from huggingface_hub import HfApi, ModelCard, ModelCardData
|
||||
@@ -81,6 +79,7 @@ from questionary import Choice, Style
|
||||
from rich.markup import escape
|
||||
from rich.table import Table
|
||||
from rich.text import Text
|
||||
from rich.traceback import install
|
||||
|
||||
from .config import (
|
||||
DatasetSpecification,
|
||||
@@ -662,18 +661,6 @@ def run():
|
||||
modifier = modifier_entry.modifier
|
||||
modifier_name = modifier_entry.name
|
||||
|
||||
def write_plugin_settings_to_config() -> None:
|
||||
# Plugins may mutate their settings at any time (e.g. pinning dataset
|
||||
# commits during initialization, or resolving values during scoring),
|
||||
# so the effective plugin settings are recorded immediately before
|
||||
# every serialization of the settings object, to ensure that the
|
||||
# serialized settings reflect the exact configuration that was used.
|
||||
evaluator.write_settings_to_config()
|
||||
modifier.write_settings_to_config(
|
||||
"modifier",
|
||||
modifier_entry.config.instance_name,
|
||||
)
|
||||
|
||||
# Clear cache before starting the optimization study.
|
||||
# This should free up memory from temporary objects created while initializing modifiers.
|
||||
empty_cache()
|
||||
@@ -752,7 +739,6 @@ def run():
|
||||
load_if_exists=True,
|
||||
)
|
||||
|
||||
write_plugin_settings_to_config()
|
||||
study.set_user_attr("settings", settings.model_dump_json())
|
||||
study.set_user_attr("finished", False)
|
||||
|
||||
@@ -829,14 +815,6 @@ def run():
|
||||
)
|
||||
)
|
||||
|
||||
if settings.enable_shell:
|
||||
choices.append(
|
||||
Choice(
|
||||
title="Open in-context Python shell",
|
||||
value="shell",
|
||||
)
|
||||
)
|
||||
|
||||
choices.append(
|
||||
Choice(
|
||||
title="Exit program",
|
||||
@@ -913,7 +891,6 @@ def run():
|
||||
continue
|
||||
|
||||
settings.n_trials = len(study.trials) + n_additional_trials
|
||||
write_plugin_settings_to_config()
|
||||
study.set_user_attr("settings", settings.model_dump_json())
|
||||
study.set_user_attr("finished", False)
|
||||
|
||||
@@ -930,53 +907,6 @@ def run():
|
||||
|
||||
break
|
||||
|
||||
if settings.enable_shell and trial == "shell":
|
||||
print()
|
||||
print(
|
||||
"[bold blue]This is an IPython shell running inside this Heretic session.[/]"
|
||||
)
|
||||
print("Among other things, it has access to the following objects:")
|
||||
print(
|
||||
"* [bold]settings[/], which can be both read from and written to"
|
||||
)
|
||||
print(
|
||||
"* [bold]model[/], with the [bold]model.model[/] and [bold]model.tokenizer[/] Transformers objects"
|
||||
)
|
||||
print(
|
||||
"* [bold]study[/], containing all trials in [bold]study.trials[/], and the Pareto front in [bold]study.best_trials[/]"
|
||||
)
|
||||
print(
|
||||
"* The special function [bold]choose_trial(trial)[/], which exits the shell and proceeds with the normal Heretic flow "
|
||||
"using the given trial object. The trial object is not restricted to trials from the Pareto front, "
|
||||
"and can even be constructed ad-hoc."
|
||||
)
|
||||
print(
|
||||
"[yellow]The shell is not sandboxed and won't stop you from corrupting objects beyond repair. "
|
||||
"With great power comes great responsibility.[/]"
|
||||
)
|
||||
|
||||
def choose_trial(chosen_trial: Trial) -> None:
|
||||
nonlocal trial
|
||||
trial = chosen_trial
|
||||
IPython.get_ipython().ask_exit()
|
||||
|
||||
# IPython installs a custom traceback handler
|
||||
# that overrides the Rich handler we installed.
|
||||
old_excepthook = sys.excepthook
|
||||
|
||||
try:
|
||||
IPython.embed(
|
||||
display_banner=False,
|
||||
colors="neutral",
|
||||
confirm_exit=False,
|
||||
)
|
||||
finally:
|
||||
sys.excepthook = old_excepthook
|
||||
|
||||
if trial == "shell":
|
||||
# choose_trial wasn't called inside the shell session.
|
||||
continue
|
||||
|
||||
print()
|
||||
print(
|
||||
f"Restoring model from trial [bold]{trial.user_attrs['index']}[/]..."
|
||||
@@ -995,7 +925,7 @@ def run():
|
||||
modifier.reset_model(ctx)
|
||||
print(f"* Modifying model using {modifier_name}...")
|
||||
parameters = modifier.parameters_class.from_dict(
|
||||
trial.user_attrs["parameters"] # ty: ignore[unresolved-attribute]
|
||||
trial.user_attrs["parameters"]
|
||||
)
|
||||
modifier.modify_model(ctx, parameters)
|
||||
|
||||
@@ -1075,6 +1005,7 @@ def run():
|
||||
save_directory,
|
||||
max_shard_size=settings.max_shard_size,
|
||||
)
|
||||
print(f"Model saved to [bold]{save_directory}[/].")
|
||||
else:
|
||||
print("Saving merged model...")
|
||||
merged_model = model.get_merged_model()
|
||||
@@ -1087,8 +1018,10 @@ def run():
|
||||
model.tokenizer.save_pretrained(save_directory)
|
||||
if model.processor is not None:
|
||||
model.processor.save_pretrained(save_directory)
|
||||
|
||||
print(f"Model saved to [bold]{save_directory}[/].")
|
||||
print(f"Model saved to [bold]{save_directory}[/].")
|
||||
# Merging replaced the trial's adapter in place.
|
||||
# Restore it only after the save has been reported.
|
||||
reset_trial_model()
|
||||
|
||||
if reproduction_mode:
|
||||
print("Verifying hashes of weight files...")
|
||||
@@ -1115,9 +1048,6 @@ def run():
|
||||
f"[bold]{filename}:[/] [red]File not found[/]"
|
||||
)
|
||||
|
||||
if strategy != ExportStrategy.ADAPTER:
|
||||
reset_trial_model()
|
||||
|
||||
case "upload":
|
||||
# We don't use huggingface_hub.login() because that stores the token on disk,
|
||||
# and since this program will often be run on rented or shared GPU servers,
|
||||
@@ -1245,6 +1175,7 @@ def run():
|
||||
max_shard_size=settings.max_shard_size,
|
||||
token=token,
|
||||
)
|
||||
print(f"Model uploaded to [bold]{repo_id}[/].")
|
||||
else:
|
||||
print("Uploading merged model...")
|
||||
merged_model = model.get_merged_model()
|
||||
@@ -1267,6 +1198,10 @@ def run():
|
||||
private=private,
|
||||
token=token,
|
||||
)
|
||||
print(f"Model uploaded to [bold]{repo_id}[/].")
|
||||
# Merging replaced the trial's adapter in place.
|
||||
# Restore it only after the upload has been reported.
|
||||
reset_trial_model()
|
||||
|
||||
if is_hf_path(settings.model):
|
||||
card = ModelCard.load(settings.model)
|
||||
@@ -1313,22 +1248,8 @@ def run():
|
||||
card.push_to_hub(repo_id, token=token)
|
||||
|
||||
if reproducibility_information != "none":
|
||||
# Record the final effective plugin settings so that the
|
||||
# exported config.toml and reproduce.json reflect the exact
|
||||
# configuration that was used.
|
||||
write_plugin_settings_to_config()
|
||||
# Refresh the settings stored in the study journal to allow
|
||||
# continuation with the current plugin state.
|
||||
study.set_user_attr(
|
||||
"settings",
|
||||
settings.model_dump_json(),
|
||||
)
|
||||
|
||||
# Set the number of trials to the number of actual completed trials
|
||||
# for the reproduction configuration.
|
||||
# These updates are deliberately *not* written to the journal,
|
||||
# because the purpose of the journal is continuing the study with
|
||||
# more trials, and potentially choosing a different export strategy.
|
||||
settings.n_trials = len(study.trials)
|
||||
current_export_strategy = settings.export_strategy
|
||||
settings.export_strategy = strategy
|
||||
@@ -1348,8 +1269,6 @@ def run():
|
||||
finally:
|
||||
settings.export_strategy = current_export_strategy
|
||||
|
||||
print(f"Model uploaded to [bold]{repo_id}[/].")
|
||||
|
||||
if reproduction_mode:
|
||||
print("Verifying hashes of weight files...")
|
||||
|
||||
@@ -1401,9 +1320,6 @@ def run():
|
||||
f"[bold]{filename}:[/] [red]File not found[/]"
|
||||
)
|
||||
|
||||
if strategy != ExportStrategy.ADAPTER:
|
||||
reset_trial_model()
|
||||
|
||||
case "chat":
|
||||
print()
|
||||
print(
|
||||
@@ -1551,7 +1467,8 @@ def run():
|
||||
|
||||
|
||||
def main():
|
||||
rich.traceback.install()
|
||||
# Install Rich traceback handler.
|
||||
install()
|
||||
|
||||
try:
|
||||
run()
|
||||
|
||||
@@ -235,10 +235,6 @@ class Model:
|
||||
)
|
||||
],
|
||||
max_new_tokens=1,
|
||||
# The KV cache is deliberately left enabled here so we can
|
||||
# catch dtype errors related to the cache, which we will need
|
||||
# for generating responses.
|
||||
# use_cache=False,
|
||||
)
|
||||
except Exception as error:
|
||||
self.model = None
|
||||
@@ -859,11 +855,7 @@ class Model:
|
||||
)
|
||||
)
|
||||
|
||||
self.generate(
|
||||
prompts,
|
||||
max_new_tokens=1,
|
||||
use_cache=False,
|
||||
)
|
||||
self.generate(prompts, max_new_tokens=1)
|
||||
|
||||
for hook_handle in hook_handles:
|
||||
hook_handle.remove()
|
||||
|
||||
+3
-43
@@ -8,16 +8,7 @@ import sys
|
||||
import types
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import (
|
||||
Annotated,
|
||||
Any,
|
||||
TypeVar,
|
||||
Union,
|
||||
cast,
|
||||
get_args,
|
||||
get_origin,
|
||||
get_type_hints,
|
||||
)
|
||||
from typing import Annotated, Any, TypeVar, Union, get_args, get_origin, get_type_hints
|
||||
|
||||
from pydantic import BaseModel
|
||||
from torch import Tensor
|
||||
@@ -211,23 +202,14 @@ class Plugin:
|
||||
"""
|
||||
Whether runs using this plugin can be reproduced bit-for-bit.
|
||||
|
||||
Set to False if the plugin's behavior is not deterministic or depends on
|
||||
Set to False when the plugin's behavior is not deterministic or depends on
|
||||
state outside the pinned config, for example:
|
||||
- It calls an external service (e.g. an LLM judge over the OpenAI API).
|
||||
- It reads credentials or config from the environment (env vars, files).
|
||||
- It is otherwise non-deterministic (network, wall-clock, unseeded RNG).
|
||||
|
||||
Defaults to False; override to True in your plugin class if the
|
||||
Defaults to False; override to True in your plugin class if any of the
|
||||
above DO NOT apply.
|
||||
|
||||
Note: The plugin can use non-deterministic/external state if the plugin
|
||||
evaluates the state during initialization and stores it in its settings
|
||||
object in such a way that re-running the plugin with the modified settings
|
||||
guarantees identical state. A plugin may also do this after initialization
|
||||
(i.e., during execution), but only if setting that state at initialization
|
||||
time during a later run results in identical plugin behavior. This can be
|
||||
used to perform tasks such as pinning dataset commits, or automatically
|
||||
determining batch sizes.
|
||||
"""
|
||||
return False
|
||||
|
||||
@@ -356,28 +338,6 @@ class Plugin:
|
||||
return None
|
||||
return settings_model.model_validate(raw_namespace or {})
|
||||
|
||||
def write_settings_to_config(
|
||||
self,
|
||||
top_namespace: str,
|
||||
instance_name: str | None,
|
||||
) -> None:
|
||||
"""
|
||||
Write the plugin's effective (validated) settings back into
|
||||
`heretic_settings.model_extra`, under the same namespace from which
|
||||
the raw settings were read.
|
||||
"""
|
||||
if self.settings is None:
|
||||
return
|
||||
|
||||
class_name = self.__class__.__name__
|
||||
key = class_name if not instance_name else f"{class_name}_{instance_name}"
|
||||
|
||||
# Settings uses extra="allow", so model_extra is always a dictionary.
|
||||
extra = cast(dict[str, Any], self.heretic_settings.model_extra)
|
||||
namespace: dict[str, Any] = extra.setdefault(top_namespace, {})
|
||||
|
||||
namespace[key] = self.settings.model_dump()
|
||||
|
||||
def get_dataset_specifications(self) -> list[DatasetSpecification]:
|
||||
"""
|
||||
Collect the dataset specifications declared in the settings
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import lm_eval
|
||||
from lm_eval.models.huggingface import HFLM
|
||||
from pydantic import BaseModel, Field, NonNegativeInt
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from heretic.scorer import Context, Score, Scorer
|
||||
|
||||
@@ -24,11 +24,6 @@ class Settings(BaseModel):
|
||||
description="Task metric to use as the benchmark score.",
|
||||
)
|
||||
|
||||
batch_size: NonNegativeInt = Field(
|
||||
default=0, # auto
|
||||
description="Number of input sequences to process in parallel (0 = auto).",
|
||||
)
|
||||
|
||||
|
||||
class BenchmarkScore(Scorer):
|
||||
"""
|
||||
@@ -45,27 +40,29 @@ class BenchmarkScore(Scorer):
|
||||
def score_name(self) -> str:
|
||||
return self.settings.score_name
|
||||
|
||||
def get_score(self, ctx: Context) -> Score:
|
||||
def init(self, ctx: Context) -> None:
|
||||
model = ctx.get_model()
|
||||
|
||||
hflm = HFLM(
|
||||
self.hflm = HFLM(
|
||||
pretrained=model.model,
|
||||
tokenizer=model.tokenizer, # ty: ignore[invalid-argument-type]
|
||||
batch_size="auto"
|
||||
if self.settings.batch_size == 0
|
||||
else self.settings.batch_size,
|
||||
tokenizer=model.tokenizer, # ty:ignore[invalid-argument-type]
|
||||
batch_size="auto",
|
||||
)
|
||||
|
||||
def get_score(self, ctx: Context) -> Score:
|
||||
# The purpose of this hack, where we initialize the HFLM object once,
|
||||
# then update its internal model every time we calculate the score,
|
||||
# is to get the benefits of batch size caching while allowing for
|
||||
# model reloads, e.g. when using --evaluate-model.
|
||||
model = ctx.get_model()
|
||||
self.hflm.pretrained = model.model
|
||||
self.hflm._model = model.model
|
||||
|
||||
results = lm_eval.simple_evaluate(
|
||||
model=hflm,
|
||||
model=self.hflm,
|
||||
tasks=[self.settings.task],
|
||||
)
|
||||
|
||||
if self.settings.batch_size == 0 and hflm.batch_sizes:
|
||||
# Cache automatically determined batch size to avoid re-determining
|
||||
# the batch size on every future run.
|
||||
self.settings.batch_size = min(hflm.batch_sizes.values())
|
||||
|
||||
benchmark_score = float(
|
||||
results["results"][self.settings.task][self.settings.metric]
|
||||
)
|
||||
|
||||
+1
-17
@@ -372,26 +372,10 @@ def get_readme_intro(
|
||||
"""
|
||||
|
||||
|
||||
def _strip_none_values(data: Any) -> Any:
|
||||
"""Return a copy of the data with all None values removed (TOML has no null value)."""
|
||||
if isinstance(data, dict):
|
||||
return {
|
||||
key: _strip_none_values(value)
|
||||
for key, value in data.items()
|
||||
if value is not None
|
||||
}
|
||||
if isinstance(data, list):
|
||||
return [_strip_none_values(value) for value in data]
|
||||
return data
|
||||
|
||||
|
||||
def generate_config_toml(settings: Settings) -> str:
|
||||
"""Serializes the full Settings object to TOML."""
|
||||
|
||||
# The `exclude_none` option can't be used here because it only applies
|
||||
# to model fields, and does not remove None values contained in extra
|
||||
# (plugin settings) dictionaries.
|
||||
return tomli_w.dumps(_strip_none_values(settings.model_dump()))
|
||||
return tomli_w.dumps(settings.model_dump(exclude_none=True))
|
||||
|
||||
|
||||
def generate_requirements_txt() -> str:
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (C) 2025-2026 Philipp Emanuel Weidmann <pew@worldwidemann.com> + contributors
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from heretic.config import Settings
|
||||
from heretic.plugin import Plugin
|
||||
from heretic.utils import generate_config_toml
|
||||
|
||||
|
||||
class DummyNestedSettings(BaseModel):
|
||||
commit: str | None = None
|
||||
name: str = "default"
|
||||
|
||||
|
||||
class DummySettings(BaseModel):
|
||||
value: int = 0
|
||||
optional: str | None = None
|
||||
nested: DummyNestedSettings = DummyNestedSettings()
|
||||
|
||||
|
||||
FULL_SETTINGS = {
|
||||
"value": 42,
|
||||
"optional": None,
|
||||
"nested": {"commit": None, "name": "default"},
|
||||
}
|
||||
|
||||
|
||||
class DummyPlugin(Plugin):
|
||||
settings: DummySettings
|
||||
|
||||
|
||||
class WriteSettingsToConfigTests(unittest.TestCase):
|
||||
def make_settings(self) -> Settings:
|
||||
# Ensure no config.toml or HERETIC_* environment variables
|
||||
# from the surrounding environment leak into the test.
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
environment = {
|
||||
key: value
|
||||
for key, value in os.environ.items()
|
||||
if not key.startswith("HERETIC_")
|
||||
}
|
||||
previous_directory = os.getcwd()
|
||||
os.chdir(directory)
|
||||
try:
|
||||
with (
|
||||
patch.dict(os.environ, environment, clear=True),
|
||||
patch.object(sys, "argv", ["heretic"]),
|
||||
):
|
||||
return Settings(model="dummy")
|
||||
finally:
|
||||
os.chdir(previous_directory)
|
||||
|
||||
def make_plugin(self, heretic_settings: Settings) -> DummyPlugin:
|
||||
return DummyPlugin(
|
||||
heretic_settings=heretic_settings,
|
||||
settings=DummySettings(value=42),
|
||||
)
|
||||
|
||||
def test_records_effective_settings_without_config_file(self) -> None:
|
||||
# Without a configuration file, model_extra starts out empty,
|
||||
# and the plugin's settings must still be recorded.
|
||||
heretic_settings = self.make_settings()
|
||||
self.assertEqual(heretic_settings.model_extra, {})
|
||||
|
||||
self.make_plugin(heretic_settings).write_settings_to_config("scorer", None)
|
||||
|
||||
self.assertEqual(
|
||||
heretic_settings.model_extra,
|
||||
{"scorer": {"DummyPlugin": FULL_SETTINGS}},
|
||||
)
|
||||
|
||||
def test_records_instance_settings_under_instance_key(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
|
||||
self.make_plugin(heretic_settings).write_settings_to_config("scorer", "small")
|
||||
|
||||
self.assertEqual(
|
||||
heretic_settings.model_extra,
|
||||
{"scorer": {"DummyPlugin_small": FULL_SETTINGS}},
|
||||
)
|
||||
|
||||
def test_captures_runtime_mutations(self) -> None:
|
||||
# Plugins resolve settings values at runtime (e.g. pinned dataset
|
||||
# commits); the recorded settings must reflect those mutations.
|
||||
heretic_settings = self.make_settings()
|
||||
plugin = self.make_plugin(heretic_settings)
|
||||
|
||||
plugin.settings.value = 7
|
||||
plugin.settings.optional = "resolved"
|
||||
plugin.settings.nested.commit = "abc"
|
||||
|
||||
plugin.write_settings_to_config("modifier", None)
|
||||
|
||||
self.assertEqual(
|
||||
heretic_settings.model_extra,
|
||||
{
|
||||
"modifier": {
|
||||
"DummyPlugin": {
|
||||
"value": 7,
|
||||
"optional": "resolved",
|
||||
"nested": {"commit": "abc", "name": "default"},
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def test_recorded_settings_survive_serialization_roundtrip(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
self.make_plugin(heretic_settings).write_settings_to_config("scorer", None)
|
||||
|
||||
# This is how settings are stored in study journal files and
|
||||
# reproduce.json, and how they are restored when resuming
|
||||
# a study or reproducing a model.
|
||||
restored = Settings.model_validate_init_only(
|
||||
json.loads(heretic_settings.model_dump_json()), heretic_settings
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
restored.model_extra,
|
||||
{"scorer": {"DummyPlugin": FULL_SETTINGS}},
|
||||
)
|
||||
|
||||
def test_recorded_settings_appear_in_generated_config_toml(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
self.make_plugin(heretic_settings).write_settings_to_config("scorer", None)
|
||||
|
||||
exported = generate_config_toml(heretic_settings)
|
||||
|
||||
# None values are omitted (TOML has no null value); they fall back
|
||||
# to their defaults when the settings are validated.
|
||||
self.assertIn("[scorer.DummyPlugin]", exported)
|
||||
self.assertIn("value = 42", exported)
|
||||
self.assertNotIn("optional", exported)
|
||||
self.assertIn("[scorer.DummyPlugin.nested]", exported)
|
||||
self.assertIn('name = "default"', exported)
|
||||
self.assertNotIn("commit", exported)
|
||||
|
||||
def test_none_values_are_omitted_from_config_toml(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
plugin = self.make_plugin(heretic_settings)
|
||||
plugin.settings.nested.commit = "abc"
|
||||
plugin.write_settings_to_config("scorer", None)
|
||||
|
||||
exported = generate_config_toml(heretic_settings)
|
||||
|
||||
self.assertNotIn("optional", exported)
|
||||
self.assertIn("[scorer.DummyPlugin.nested]", exported)
|
||||
self.assertIn('commit = "abc"', exported)
|
||||
self.assertIn('name = "default"', exported)
|
||||
|
||||
def test_recorded_settings_feed_back_into_plugin_validation(self) -> None:
|
||||
# The recorded settings must be readable by the same mechanism
|
||||
# that reads raw settings from the configuration file, so that
|
||||
# resuming a study or reproducing a model restores them exactly.
|
||||
heretic_settings = self.make_settings()
|
||||
self.make_plugin(heretic_settings).write_settings_to_config("scorer", None)
|
||||
|
||||
raw_settings = DummyPlugin.get_settings_raw(
|
||||
heretic_settings.model_extra, "scorer", None
|
||||
)
|
||||
validated = DummyPlugin.validate_settings(raw_settings)
|
||||
|
||||
self.assertEqual(validated, DummySettings(value=42))
|
||||
|
||||
def test_records_multiple_instances_independently(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
extra = heretic_settings.model_extra
|
||||
assert extra is not None
|
||||
|
||||
first = self.make_plugin(heretic_settings)
|
||||
second = self.make_plugin(heretic_settings)
|
||||
|
||||
# Different values ensure that neither instance overwrites the other.
|
||||
first.settings.value = 10
|
||||
second.settings.value = 20
|
||||
|
||||
first.write_settings_to_config("scorer", "small")
|
||||
second.write_settings_to_config("scorer", "large")
|
||||
|
||||
self.assertEqual(
|
||||
extra["scorer"],
|
||||
{
|
||||
"DummyPlugin_small": {**FULL_SETTINGS, "value": 10},
|
||||
"DummyPlugin_large": {**FULL_SETTINGS, "value": 20},
|
||||
},
|
||||
)
|
||||
|
||||
def test_repeated_writes_update_recorded_settings(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
extra = heretic_settings.model_extra
|
||||
assert extra is not None
|
||||
|
||||
plugin = self.make_plugin(heretic_settings)
|
||||
|
||||
plugin.write_settings_to_config("scorer", None)
|
||||
|
||||
# Subsequent writes must capture settings mutations made at runtime.
|
||||
plugin.settings.value = 123
|
||||
plugin.write_settings_to_config("scorer", None)
|
||||
|
||||
self.assertEqual(
|
||||
extra["scorer"]["DummyPlugin"]["value"],
|
||||
123,
|
||||
)
|
||||
|
||||
def test_nested_none_values_fail_toml_serialization(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
extra = heretic_settings.model_extra
|
||||
assert extra is not None
|
||||
|
||||
# None values inside lists cannot be represented in TOML and must
|
||||
# cause serialization to fail rather than be silently removed.
|
||||
extra["scorer"] = {
|
||||
"DummyPlugin": {
|
||||
"values": [1, None, 3],
|
||||
}
|
||||
}
|
||||
|
||||
with self.assertRaises((TypeError, ValueError)):
|
||||
generate_config_toml(heretic_settings)
|
||||
|
||||
def test_plugins_without_settings_do_not_create_config_entries(self) -> None:
|
||||
heretic_settings = self.make_settings()
|
||||
|
||||
plugin = DummyPluginWithoutSettings(
|
||||
heretic_settings=heretic_settings,
|
||||
)
|
||||
plugin.write_settings_to_config("scorer", None)
|
||||
|
||||
self.assertEqual(heretic_settings.model_extra, {})
|
||||
|
||||
|
||||
class DummyPluginWithoutSettings(Plugin):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -301,15 +301,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", hash = "sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", size = 132079, upload-time = "2026-09-05T10:42:37.923Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asttokens"
|
||||
version = "3.0.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/25/1e/faf0f247f6f881b98fc4d6d07e14085cb89d13665084e6d6ac1dc2c03d0b/asttokens-3.0.2.tar.gz", hash = "sha256:3ecdbd8f2cc195f53ccada3a613538bb5f9ef6f6869129f13e03c30a677b8fe2", size = 63136, upload-time = "2026-07-12T03:31:49.084Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/2b/04b8a15f3a1c77bc79ddf5c73875327f34b4fa75982df2b76e45e402d364/asttokens-3.0.2-py3-none-any.whl", hash = "sha256:9da13157f5b28becde0bd374fc677dcd3c290614264eff096f167c469cd9f933", size = 28702, upload-time = "2026-07-12T03:31:47.542Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-timeout"
|
||||
version = "5.0.1"
|
||||
@@ -789,15 +780,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/44/0b/98fc6eb83333508ca5f44c52b3e287ea8137a0ad582714e2cbc67a02154b/datasets-5.0.1-py3-none-any.whl", hash = "sha256:9fbf73688f8c18f7529b4fe592abd04015f81d1e58001e4bac73ffb2b39d7cc4", size = 559079, upload-time = "2026-07-28T11:09:10.266Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "decorator"
|
||||
version = "5.3.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/60/8b/32f9823da46cde7df2087faa08cd98d01b908f8dcab982cdba9c84e85355/decorator-5.3.1.tar.gz", hash = "sha256:4cbcdd55a6efadb9dbea26b858f4fb3264567b52d69ca0d25b721b553f60ea82", size = 58084, upload-time = "2026-05-18T06:03:28.057Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/05/7f/798705f5296a58ca505d600456748d1be48078eac8a7050d8a98bc9edb89/decorator-5.3.1-py3-none-any.whl", hash = "sha256:f47fe6fdbd2edd623ecfe36875d37aba411624e2670dd395dddae1358689bb3c", size = 10365, upload-time = "2026-05-18T06:03:26.517Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "defusedxml"
|
||||
version = "0.7.1"
|
||||
@@ -875,15 +857,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "executing"
|
||||
version = "2.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/52/92/8a611141e42930c0f194f7504063ab87dfe970cf1a5af28e7703df448734/executing-2.3.0.tar.gz", hash = "sha256:15919cb5d667e5cb4e099511971d00d659573fff2dd5c4e6cd8b71636c7858d2", size = 1338003, upload-time = "2026-10-10T14:06:04.64Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4d/dd/8bc67e7d5ffc1d88aa5af511189dfb76dc4e1e5b808fab186146ef2663e5/executing-2.3.0-py3-none-any.whl", hash = "sha256:736e859c9f8701f11fcf516856f26f562e04776387824b43a35a1dfe21c84122", size = 29393, upload-time = "2026-10-10T14:06:02.777Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filelock"
|
||||
version = "4.0.8"
|
||||
@@ -1109,7 +1082,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "heretic-llm"
|
||||
version = "2.2.0.dev0"
|
||||
version = "2.1.0.dev0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "accelerate" },
|
||||
@@ -1117,7 +1090,6 @@ dependencies = [
|
||||
{ name = "datasets" },
|
||||
{ name = "huggingface-hub" },
|
||||
{ name = "immutabledict" },
|
||||
{ name = "ipython" },
|
||||
{ name = "langdetect" },
|
||||
{ name = "lm-eval", extra = ["hf"] },
|
||||
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
|
||||
@@ -1152,7 +1124,6 @@ requires-dist = [
|
||||
{ name = "datasets", specifier = "~=5.0" },
|
||||
{ name = "huggingface-hub", specifier = "~=1.33" },
|
||||
{ name = "immutabledict", specifier = "~=4.3" },
|
||||
{ name = "ipython", specifier = "~=8.39" },
|
||||
{ name = "langdetect", specifier = "~=1.0" },
|
||||
{ name = "lm-eval", extras = ["hf"], specifier = "~=0.4" },
|
||||
{ name = "numpy", specifier = "~=2.2" },
|
||||
@@ -1288,40 +1259,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/68/bd9dd6bbf06772c7accce77d0354d783333fbe712a60b08fc13540c05422/importlib_resources-5.13.0-py3-none-any.whl", hash = "sha256:9f7bd0c97b79972a6cce36a366356d16d5e13b09679c11a58f1014bfdf8e64b2", size = 32912, upload-time = "2023-07-07T16:20:58.128Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipython"
|
||||
version = "8.39.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "decorator" },
|
||||
{ name = "exceptiongroup", marker = "python_full_version < '3.11'" },
|
||||
{ name = "jedi" },
|
||||
{ name = "matplotlib-inline" },
|
||||
{ name = "pexpect", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
||||
{ name = "prompt-toolkit" },
|
||||
{ name = "pygments" },
|
||||
{ name = "stack-data" },
|
||||
{ name = "traitlets" },
|
||||
{ name = "typing-extensions", marker = "python_full_version < '3.12'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/40/18/f8598d287006885e7136451fdea0755af4ebcbfe342836f24deefaed1164/ipython-8.39.0.tar.gz", hash = "sha256:4110ae96012c379b8b6db898a07e186c40a2a1ef5d57a7fa83166047d9da7624", size = 5513971, upload-time = "2026-03-27T10:02:13.94Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/56/4cc7fc9e9e3f38fd324f24f8afe0ad8bb5fa41283f37f1aaf9de0612c968/ipython-8.39.0-py3-none-any.whl", hash = "sha256:bb3c51c4fa8148ab1dea07a79584d1c854e234ea44aa1283bcb37bc75054651f", size = 831849, upload-time = "2026-03-27T10:02:07.846Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jedi"
|
||||
version = "0.20.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "parso" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a3/a4/4692ecd7fa700ac1066b1c1f6cadef60aa2e01e5e364710235137d823e0a/jedi-0.20.1.tar.gz", hash = "sha256:2f71208c3f9c1bca057c0e90d3f272aba44ace88fc4067d7587e9e069331b7e5", size = 3121738, upload-time = "2026-10-12T17:42:24.361Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/be/c7/71eb0d51cdcbb63b857c931aa4e9218b078b5d9f8ecd383b234f28fe7b0f/jedi-0.20.1-py2.py3-none-any.whl", hash = "sha256:0fb16d86c4a4c73c37ba518c77419975e30fcc620658a8d14fbb5720cdd34142", size = 4885980, upload-time = "2026-10-12T17:42:21.585Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jinja2"
|
||||
version = "3.1.6"
|
||||
@@ -1701,18 +1638,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/70/bc/6f1c2f612465f5fa89b95bead1f44dcb607670fd42891d8fdcd5d039f4f4/markupsafe-3.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa", size = 14146, upload-time = "2025-09-27T18:37:28.327Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matplotlib-inline"
|
||||
version = "0.2.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "traitlets" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/bd/c0/9f7c9a46090390368a4d7bcb76bb87a4a36c421e4c0792cdb53486ffac7a/matplotlib_inline-0.2.2.tar.gz", hash = "sha256:72f3fe8fce36b70d4a5b612f899090cd0401deddc4ea90e1572b9f4bfb058c79", size = 8150, upload-time = "2026-05-08T17:33:33.49Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/41/09/5b161152e2d90f7b87f781c2e1267494aef9c32498df793f73ad0a0a494a/matplotlib_inline-0.2.2-py3-none-any.whl", hash = "sha256:3c821cf1c209f59fb2d2d64abbf5b23b67bcb2210d663f9918dd851c6da1fcf6", size = 9534, upload-time = "2026-05-08T17:33:32.055Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mbstrdecoder"
|
||||
version = "1.1.5"
|
||||
@@ -2442,15 +2367,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0b/a3/6419c14da2adc1f09a6a183b8f91d7494d325b287f4ca984ac04f663638a/pandas-3.0.6-cp315-cp315t-win_arm64.whl", hash = "sha256:963ca21199097a84c7827c4678b04e30833084fbf8ef44fde3fa7180a29f8fa0", size = 9364529, upload-time = "2026-09-17T23:23:15.274Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parso"
|
||||
version = "0.8.7"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/30/4b/90c937815137d43ce71ba043cd3566221e9df6b9c805f24b5d138c9d40a7/parso-0.8.7.tar.gz", hash = "sha256:eaaac4c9fdd5e9e8852dc778d2d7405897ec510f2a298071453e5e3a07914bb1", size = 401824, upload-time = "2026-05-01T23:13:02.138Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/99/5d/8268b644392ee874ee82a635cd0df1773de230bde356c38de28e298392cc/parso-0.8.7-py2.py3-none-any.whl", hash = "sha256:a8926eb2a1b915486941fdbd31e86a4baf88fe8c210f25f2f35ecec5b574ca1c", size = 107025, upload-time = "2026-05-01T23:12:58.867Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pathvalidate"
|
||||
version = "3.3.1"
|
||||
@@ -2484,18 +2400,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/70/0b/59441cdbfdd342ed03c08af90a2fe16173f0cd48ab219f523b39ca059a79/peft-0.21.2-py3-none-any.whl", hash = "sha256:106ab6077ff72c54d21577f9af5970e34bac7582cb14209f7b2b511e322a4eae", size = 835427, upload-time = "2026-10-01T10:26:34.085Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pexpect"
|
||||
version = "4.9.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "ptyprocess" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/42/92/cc564bf6381ff43ce1f4d06852fc19a2f11d180f23dc32d9588bee2f149d/pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f", size = 166450, upload-time = "2023-11-25T09:07:26.339Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/9e/c3/059298687310d527a58bb01f3b1965787ee3b40dce76752eda8b44e9a2c5/pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523", size = 63772, upload-time = "2023-11-25T06:56:14.81Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pillow"
|
||||
version = "12.3.0"
|
||||
@@ -2793,24 +2697,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/c7/7bb2e321574b10df20cbde462a94e2b71d05f9bbda251ef27d104668306a/psutil-7.2.2-cp37-abi3-win_arm64.whl", hash = "sha256:8c233660f575a5a89e6d4cb65d9f938126312bca76d8fe087b947b3a1aaac9ee", size = 134617, upload-time = "2026-01-28T18:15:36.514Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ptyprocess"
|
||||
version = "0.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/20/e5/16ff212c1e452235a90aeb09066144d0c5a6a8c0834397e03f5224495c4e/ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220", size = 70762, upload-time = "2020-12-28T15:15:30.155Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/22/a6/858897256d0deac81a172289110f31629fc4cee19b6f01283303e18c8db3/ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", size = 13993, upload-time = "2020-12-28T15:15:28.35Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pure-eval"
|
||||
version = "0.2.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/da/9f/abfd2959e9261dd5217ca8551d4de211ca6ab26fe9b72cf44731ff6c4442/pure_eval-0.2.4.tar.gz", hash = "sha256:260c2774686e651b79f8b8e7fc9d80b3599ea6a66334b47d5f4abb69fc2c0ea1", size = 20563, upload-time = "2026-09-10T21:41:22.836Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/18/83376915176eb058cb86470eb7396388a13350b09a8f233a79303bbcbc5b/pure_eval-0.2.4-py3-none-any.whl", hash = "sha256:96cae060a313cfaad51bb761278bfb0e62dc0248d9315a81173752dc546cd37a", size = 11893, upload-time = "2026-09-10T21:41:21.532Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "py-cpuinfo"
|
||||
version = "9.0.0"
|
||||
@@ -4062,20 +3948,6 @@ version = "2.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/12/9a/7620d1e9dcb02839ed6d4b14064e609cdd7a8ae1e47289aa0456796dd9ca/sqlitedict-2.1.0.tar.gz", hash = "sha256:03d9cfb96d602996f1d4c2db2856f1224b96a9c431bdd16e78032a72940f9e8c", size = 21846, upload-time = "2022-12-03T13:39:13.102Z" }
|
||||
|
||||
[[package]]
|
||||
name = "stack-data"
|
||||
version = "0.6.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "asttokens" },
|
||||
{ name = "executing" },
|
||||
{ name = "pure-eval" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/28/e3/55dcc2cfbc3ca9c29519eb6884dd1415ecb53b0e934862d3559ddcb7e20b/stack_data-0.6.3.tar.gz", hash = "sha256:836a778de4fec4dcd1dcd89ed8abff8a221f58308462e1c4aa2a3cf30148f0b9", size = 44707, upload-time = "2023-09-30T13:58:05.479Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/7b/ce1eafaf1a76852e2ec9b22edecf1daa58175c090266e9f6c64afcd81d91/stack_data-0.6.3-py3-none-any.whl", hash = "sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695", size = 24521, upload-time = "2023-09-30T13:58:03.53Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sympy"
|
||||
version = "1.14.0"
|
||||
@@ -4412,15 +4284,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a7/03/921a3d3c75785aca9ebfbfcabfbc3a1be12e2ab5265deb026d55a5a3f83e/tqdm-4.70.1-py3-none-any.whl", hash = "sha256:c293e525e6fef9c20e8728fd4612df02a0aa31bb5fe91ecd93e123b1b7bffa73", size = 80199, upload-time = "2026-09-11T07:25:14.599Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "traitlets"
|
||||
version = "5.16.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/2c/2e/a7fbfe268c8a3b32546930c0297c101d65a4a14c304ad5790a9f478f0e4e/traitlets-5.16.1.tar.gz", hash = "sha256:ed900c2b631aa3a112811139fa97b8d2c3bad5e989656bba4b7e52c7852c18c1", size = 166137, upload-time = "2026-08-03T08:32:36.848Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ad/66/0d785f0bc5e4315a96c989bb476d0fc07ea4f85132550c7b156ca2035d52/traitlets-5.16.1-py3-none-any.whl", hash = "sha256:f775618166caa0396c8e337099240f2bd3e5e917d203b2e6fbe21a58d3cb1f6b", size = 86211, upload-time = "2026-08-03T08:32:34.48Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "transformers"
|
||||
version = "5.18.0"
|
||||
|
||||
Reference in new issue
Block a user