Upload 4 files
Browse files
QED-Base-v2.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71c4e5291a4f0bc77b16abc77014635d1b43d55b7e774347cc7d5ecd0ef01a8c
|
| 3 |
+
size 421245563
|
infer.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from model import load_model, load_tokenizer, run
|
| 2 |
+
|
| 3 |
+
model = load_model("QED-Base-v2.pt")
|
| 4 |
+
tokenizer = load_tokenizer("tok.model")
|
| 5 |
+
text = run("The future of ai will be", model, tokenizer, max_new_tokens=100)
|
| 6 |
+
print(text)
|
model.py
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
QED-Base-v2 inference library.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
from qed_infer import load_model, load_tokenizer, run
|
| 6 |
+
|
| 7 |
+
model = load_model("QED-Base-v2.pt")
|
| 8 |
+
tokenizer = load_tokenizer("tok.model")
|
| 9 |
+
|
| 10 |
+
text = run("Once upon a time", model, tokenizer, max_new_tokens=100)
|
| 11 |
+
|
| 12 |
+
# streaming / batched:
|
| 13 |
+
for texts in generate_stream(model, tokenizer, ["prompt A", "prompt B"]):
|
| 14 |
+
... # texts[i] is the completion-so-far for prompt i
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
from __future__ import annotations
|
| 18 |
+
|
| 19 |
+
import sys
|
| 20 |
+
from dataclasses import dataclass
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
from typing import Iterator, Optional
|
| 23 |
+
|
| 24 |
+
import torch
|
| 25 |
+
import torch.nn as nn
|
| 26 |
+
import torch.nn.functional as F
|
| 27 |
+
import sentencepiece as spm
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 31 |
+
DTYPE = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@dataclass
|
| 35 |
+
class Config:
|
| 36 |
+
vocab_size: int = 48000
|
| 37 |
+
hidden_size: int = 768
|
| 38 |
+
num_layers: int = 12
|
| 39 |
+
num_heads: int = 12
|
| 40 |
+
num_kv_heads: int = 4
|
| 41 |
+
intermediate_size: int = 1792
|
| 42 |
+
max_seq_len: int = 2048
|
| 43 |
+
rope_theta: float = 10000.0
|
| 44 |
+
rms_eps: float = 1e-6
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class RMSNorm(nn.Module):
|
| 48 |
+
def __init__(self, dim, eps=1e-6):
|
| 49 |
+
super().__init__()
|
| 50 |
+
self.weight = nn.Parameter(torch.ones(dim))
|
| 51 |
+
self.eps = eps
|
| 52 |
+
|
| 53 |
+
def forward(self, x):
|
| 54 |
+
variance = x.float().pow(2).mean(dim=-1, keepdim=True)
|
| 55 |
+
x = x * torch.rsqrt(variance + self.eps)
|
| 56 |
+
return (self.weight * x).type_as(self.weight)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def rotate_half(x):
|
| 60 |
+
x1, x2 = x.chunk(2, dim=-1)
|
| 61 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class RotaryEmbedding(nn.Module):
|
| 65 |
+
def __init__(self, head_dim, max_seq_len, theta):
|
| 66 |
+
super().__init__()
|
| 67 |
+
inv_freq = 1.0 / (theta ** (torch.arange(0, head_dim, 2).float() / head_dim))
|
| 68 |
+
positions = torch.arange(max_seq_len).float()
|
| 69 |
+
freqs = torch.outer(positions, inv_freq)
|
| 70 |
+
emb = torch.cat([freqs, freqs], dim=-1)
|
| 71 |
+
self.register_buffer("cos", emb.cos(), persistent=False)
|
| 72 |
+
self.register_buffer("sin", emb.sin(), persistent=False)
|
| 73 |
+
|
| 74 |
+
def forward(self, q, k, offset: int):
|
| 75 |
+
q_len = q.shape[-2]
|
| 76 |
+
k_len = k.shape[-2]
|
| 77 |
+
|
| 78 |
+
cos_q = self.cos[offset:offset + q_len][None, None, :, :].to(q.dtype)
|
| 79 |
+
sin_q = self.sin[offset:offset + q_len][None, None, :, :].to(q.dtype)
|
| 80 |
+
|
| 81 |
+
k_offset = offset + q_len - k_len
|
| 82 |
+
cos_k = self.cos[k_offset:k_offset + k_len][None, None, :, :].to(k.dtype)
|
| 83 |
+
sin_k = self.sin[k_offset:k_offset + k_len][None, None, :, :].to(k.dtype)
|
| 84 |
+
|
| 85 |
+
return (
|
| 86 |
+
q * cos_q + rotate_half(q) * sin_q,
|
| 87 |
+
k * cos_k + rotate_half(k) * sin_k,
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
class SwiGLU(nn.Module):
|
| 92 |
+
def __init__(self, hidden, intermediate):
|
| 93 |
+
super().__init__()
|
| 94 |
+
self.gate_proj = nn.Linear(hidden, intermediate, bias=False)
|
| 95 |
+
self.up_proj = nn.Linear(hidden, intermediate, bias=False)
|
| 96 |
+
self.down_proj = nn.Linear(intermediate, hidden, bias=False)
|
| 97 |
+
|
| 98 |
+
def forward(self, x):
|
| 99 |
+
return self.down_proj(F.silu(self.gate_proj(x)) * self.up_proj(x))
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class GQAttention(nn.Module):
|
| 103 |
+
def __init__(self, cfg: Config):
|
| 104 |
+
super().__init__()
|
| 105 |
+
self.num_heads = cfg.num_heads
|
| 106 |
+
self.num_kv_heads = cfg.num_kv_heads
|
| 107 |
+
self.head_dim = cfg.hidden_size // cfg.num_heads
|
| 108 |
+
|
| 109 |
+
self.q_proj = nn.Linear(cfg.hidden_size, cfg.num_heads * self.head_dim, bias=False)
|
| 110 |
+
self.k_proj = nn.Linear(cfg.hidden_size, cfg.num_kv_heads * self.head_dim, bias=False)
|
| 111 |
+
self.v_proj = nn.Linear(cfg.hidden_size, cfg.num_kv_heads * self.head_dim, bias=False)
|
| 112 |
+
self.o_proj = nn.Linear(cfg.hidden_size, cfg.hidden_size, bias=False)
|
| 113 |
+
|
| 114 |
+
self.rope = RotaryEmbedding(self.head_dim, cfg.max_seq_len, cfg.rope_theta)
|
| 115 |
+
|
| 116 |
+
def forward(self, x, offset: int, past_kv: Optional[tuple] = None):
|
| 117 |
+
B, T, C = x.shape
|
| 118 |
+
|
| 119 |
+
q = self.q_proj(x).view(B, T, self.num_heads, self.head_dim).transpose(1, 2)
|
| 120 |
+
k = self.k_proj(x).view(B, T, self.num_kv_heads, self.head_dim).transpose(1, 2)
|
| 121 |
+
v = self.v_proj(x).view(B, T, self.num_kv_heads, self.head_dim).transpose(1, 2)
|
| 122 |
+
|
| 123 |
+
if past_kv is not None:
|
| 124 |
+
past_k, past_v = past_kv
|
| 125 |
+
k = torch.cat([past_k, k], dim=2)
|
| 126 |
+
v = torch.cat([past_v, v], dim=2)
|
| 127 |
+
|
| 128 |
+
q, k = self.rope(q, k, offset)
|
| 129 |
+
present = (k, v)
|
| 130 |
+
|
| 131 |
+
repeat = self.num_heads // self.num_kv_heads
|
| 132 |
+
k_rep = k.repeat_interleave(repeat, dim=1)
|
| 133 |
+
v_rep = v.repeat_interleave(repeat, dim=1)
|
| 134 |
+
|
| 135 |
+
y = F.scaled_dot_product_attention(q, k_rep, v_rep, is_causal=T > 1)
|
| 136 |
+
|
| 137 |
+
y = y.transpose(1, 2).contiguous().view(B, T, C)
|
| 138 |
+
return self.o_proj(y), present
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
class QEDBlock(nn.Module):
|
| 142 |
+
def __init__(self, cfg: Config):
|
| 143 |
+
super().__init__()
|
| 144 |
+
self.attn_norm = RMSNorm(cfg.hidden_size, cfg.rms_eps)
|
| 145 |
+
self.attention = GQAttention(cfg)
|
| 146 |
+
self.ffn_norm = RMSNorm(cfg.hidden_size, cfg.rms_eps)
|
| 147 |
+
self.ffn = SwiGLU(cfg.hidden_size, cfg.intermediate_size)
|
| 148 |
+
|
| 149 |
+
def forward(self, x, offset: int, past_kv=None):
|
| 150 |
+
attn_out, present = self.attention(self.attn_norm(x), offset, past_kv)
|
| 151 |
+
x = x + attn_out
|
| 152 |
+
x = x + self.ffn(self.ffn_norm(x))
|
| 153 |
+
return x, present
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
class QEDBaseV2(nn.Module):
|
| 157 |
+
def __init__(self, cfg: Config):
|
| 158 |
+
super().__init__()
|
| 159 |
+
self.cfg = cfg
|
| 160 |
+
self.embed_tokens = nn.Embedding(cfg.vocab_size, cfg.hidden_size)
|
| 161 |
+
self.layers = nn.ModuleList([QEDBlock(cfg) for _ in range(cfg.num_layers)])
|
| 162 |
+
self.final_norm = RMSNorm(cfg.hidden_size, cfg.rms_eps)
|
| 163 |
+
self.lm_head = nn.Linear(cfg.hidden_size, cfg.vocab_size, bias=False)
|
| 164 |
+
self.lm_head.weight = self.embed_tokens.weight
|
| 165 |
+
|
| 166 |
+
def forward(self, input_ids, offset: int = 0, past_key_values: Optional[list] = None):
|
| 167 |
+
x = self.embed_tokens(input_ids)
|
| 168 |
+
new_past = []
|
| 169 |
+
for i, layer in enumerate(self.layers):
|
| 170 |
+
past_kv = past_key_values[i] if past_key_values is not None else None
|
| 171 |
+
x, present = layer(x, offset, past_kv)
|
| 172 |
+
new_past.append(present)
|
| 173 |
+
x = self.final_norm(x)
|
| 174 |
+
return self.lm_head(x), new_past
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def load_model(model_path: str, cfg: Config = Config()) -> QEDBaseV2:
|
| 178 |
+
path = Path(model_path)
|
| 179 |
+
if not path.exists():
|
| 180 |
+
raise FileNotFoundError(f"Checkpoint not found: {model_path}")
|
| 181 |
+
|
| 182 |
+
package = torch.load(path, map_location="cpu", weights_only=True)
|
| 183 |
+
state_dict = package["state_dict"] if "state_dict" in package else package
|
| 184 |
+
|
| 185 |
+
model = QEDBaseV2(cfg)
|
| 186 |
+
missing, unexpected = model.load_state_dict(state_dict, strict=False)
|
| 187 |
+
if missing:
|
| 188 |
+
print(f"[warn] missing keys: {missing}", file=sys.stderr)
|
| 189 |
+
if unexpected:
|
| 190 |
+
print(f"[warn] unexpected keys: {unexpected}", file=sys.stderr)
|
| 191 |
+
|
| 192 |
+
model.to(DEVICE, dtype=DTYPE)
|
| 193 |
+
model.eval()
|
| 194 |
+
|
| 195 |
+
name = package.get("Name", "QED-Base-v2") if isinstance(package, dict) else "QED-Base-v2"
|
| 196 |
+
author = package.get("Author", "unknown") if isinstance(package, dict) else "unknown"
|
| 197 |
+
print(f"Loaded {name} by {author} on {DEVICE} ({DTYPE})")
|
| 198 |
+
return model
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def load_tokenizer(tokenizer_path: str) -> spm.SentencePieceProcessor:
|
| 202 |
+
if not Path(tokenizer_path).exists():
|
| 203 |
+
raise FileNotFoundError(f"Tokenizer not found: {tokenizer_path}")
|
| 204 |
+
tok = spm.SentencePieceProcessor()
|
| 205 |
+
tok.load(tokenizer_path)
|
| 206 |
+
return tok
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
def _apply_repetition_penalty(logits: torch.Tensor, generated: torch.Tensor, penalty: float):
|
| 210 |
+
if penalty == 1.0:
|
| 211 |
+
return logits
|
| 212 |
+
for b in range(logits.shape[0]):
|
| 213 |
+
seen = torch.unique(generated[b])
|
| 214 |
+
vals = logits[b, seen]
|
| 215 |
+
logits[b, seen] = torch.where(vals > 0, vals / penalty, vals * penalty)
|
| 216 |
+
return logits
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
def _top_k_top_p_filter(logits: torch.Tensor, top_k: int, top_p: float):
|
| 220 |
+
if top_k > 0:
|
| 221 |
+
top_k = min(top_k, logits.size(-1))
|
| 222 |
+
kth_val = torch.topk(logits, top_k, dim=-1).values[..., -1, None]
|
| 223 |
+
logits = torch.where(logits < kth_val, torch.full_like(logits, float("-inf")), logits)
|
| 224 |
+
|
| 225 |
+
if top_p < 1.0:
|
| 226 |
+
sorted_logits, sorted_idx = torch.sort(logits, descending=True, dim=-1)
|
| 227 |
+
probs = F.softmax(sorted_logits, dim=-1)
|
| 228 |
+
cum_probs = torch.cumsum(probs, dim=-1)
|
| 229 |
+
|
| 230 |
+
remove = cum_probs > top_p
|
| 231 |
+
remove[..., 1:] = remove[..., :-1].clone()
|
| 232 |
+
remove[..., 0] = False
|
| 233 |
+
|
| 234 |
+
sorted_logits[remove] = float("-inf")
|
| 235 |
+
logits = torch.full_like(logits, float("-inf")).scatter(-1, sorted_idx, sorted_logits)
|
| 236 |
+
|
| 237 |
+
return logits
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
@torch.no_grad()
|
| 241 |
+
def generate_stream(
|
| 242 |
+
model: QEDBaseV2,
|
| 243 |
+
tokenizer: spm.SentencePieceProcessor,
|
| 244 |
+
prompts: list[str],
|
| 245 |
+
max_new_tokens: int = 200,
|
| 246 |
+
temperature: float = 0.8,
|
| 247 |
+
top_k: int = 50,
|
| 248 |
+
top_p: float = 0.95,
|
| 249 |
+
repetition_penalty: float = 1.15,
|
| 250 |
+
eos_id: Optional[int] = None,
|
| 251 |
+
) -> Iterator[list[str]]:
|
| 252 |
+
if eos_id is None:
|
| 253 |
+
eos_id = tokenizer.eos_id() if tokenizer.eos_id() >= 0 else None
|
| 254 |
+
|
| 255 |
+
encoded = [tokenizer.encode(p) for p in prompts]
|
| 256 |
+
max_len = max(len(e) for e in encoded)
|
| 257 |
+
pad_id = tokenizer.pad_id() if tokenizer.pad_id() >= 0 else 0
|
| 258 |
+
|
| 259 |
+
B = len(prompts)
|
| 260 |
+
input_ids = torch.full((B, max_len), pad_id, dtype=torch.long, device=DEVICE)
|
| 261 |
+
for i, e in enumerate(encoded):
|
| 262 |
+
input_ids[i, max_len - len(e):] = torch.tensor(e, dtype=torch.long, device=DEVICE)
|
| 263 |
+
|
| 264 |
+
generated = input_ids.clone()
|
| 265 |
+
finished = torch.zeros(B, dtype=torch.bool, device=DEVICE)
|
| 266 |
+
text_so_far = ["" for _ in range(B)]
|
| 267 |
+
|
| 268 |
+
logits, past = model(input_ids, offset=0)
|
| 269 |
+
offset = input_ids.shape[1]
|
| 270 |
+
|
| 271 |
+
for _ in range(max_new_tokens):
|
| 272 |
+
next_logits = logits[:, -1, :].float()
|
| 273 |
+
next_logits = _apply_repetition_penalty(next_logits, generated, repetition_penalty)
|
| 274 |
+
|
| 275 |
+
if temperature <= 0:
|
| 276 |
+
next_token = next_logits.argmax(dim=-1, keepdim=True)
|
| 277 |
+
else:
|
| 278 |
+
next_logits = next_logits / temperature
|
| 279 |
+
next_logits = _top_k_top_p_filter(next_logits, top_k, top_p)
|
| 280 |
+
probs = F.softmax(next_logits, dim=-1)
|
| 281 |
+
next_token = torch.multinomial(probs, num_samples=1)
|
| 282 |
+
|
| 283 |
+
next_token = torch.where(
|
| 284 |
+
finished.unsqueeze(-1), torch.full_like(next_token, pad_id), next_token
|
| 285 |
+
)
|
| 286 |
+
generated = torch.cat([generated, next_token], dim=1)
|
| 287 |
+
|
| 288 |
+
if eos_id is not None:
|
| 289 |
+
finished |= next_token.squeeze(-1) == eos_id
|
| 290 |
+
|
| 291 |
+
for i in range(B):
|
| 292 |
+
if not finished[i]:
|
| 293 |
+
text_so_far[i] = tokenizer.decode(generated[i].tolist())
|
| 294 |
+
|
| 295 |
+
yield list(text_so_far)
|
| 296 |
+
|
| 297 |
+
if bool(finished.all()):
|
| 298 |
+
break
|
| 299 |
+
|
| 300 |
+
logits, past = model(next_token, offset=offset, past_key_values=past)
|
| 301 |
+
offset += 1
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
@torch.no_grad()
|
| 305 |
+
def run(
|
| 306 |
+
prompt: str,
|
| 307 |
+
model: QEDBaseV2,
|
| 308 |
+
tokenizer: spm.SentencePieceProcessor,
|
| 309 |
+
max_new_tokens: int = 200,
|
| 310 |
+
temperature: float = 0.7,
|
| 311 |
+
top_k: int = 40,
|
| 312 |
+
top_p: float = 0.95,
|
| 313 |
+
repetition_penalty: float = 1.15,
|
| 314 |
+
) -> str:
|
| 315 |
+
final = ""
|
| 316 |
+
for texts in generate_stream(
|
| 317 |
+
model, tokenizer, [prompt],
|
| 318 |
+
max_new_tokens=max_new_tokens,
|
| 319 |
+
temperature=temperature,
|
| 320 |
+
top_k=top_k,
|
| 321 |
+
top_p=top_p,
|
| 322 |
+
repetition_penalty=repetition_penalty,
|
| 323 |
+
):
|
| 324 |
+
final = texts[0]
|
| 325 |
+
return final
|
tok.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5507c05b9eb158901b28fa8b9f2462b87c24d0dfc87b046ad5c0659ec953fe2f
|
| 3 |
+
size 1051850
|