From 2464ecafa082b14d39c1172ce0c5a65b1089a1e5 Mon Sep 17 00:00:00 2001 From: Franz Maria Heuchel <62-fhchl@users.noreply.gitlab.flowtale.ai> Date: Tue, 17 Sep 2024 14:36:04 +0200 Subject: [PATCH] use default factories for dataclass attributes --- prompts/tokens.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prompts/tokens.py b/prompts/tokens.py index 953ad9f..c9f3a98 100644 --- a/prompts/tokens.py +++ b/prompts/tokens.py @@ -1,4 +1,4 @@ -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import Dict, Optional @@ -10,10 +10,10 @@ class Limits: @dataclass class Special: - sequence: Limits = Limits("", "") - user: Limits = Limits("", "") - assistant: Limits = Limits("", "") - system: Limits = Limits("", "") + sequence: Limits = field(default_factory=lambda: Limits()) + user: Limits = field(default_factory=lambda: Limits()) + assistant: Limits = field(default_factory=lambda: Limits()) + system: Limits = field(default_factory=lambda: Limits()) SPECIAL_TOKENS: Dict[Optional[str], Special] = {