Spaces:
Sleeping
Sleeping
abhisheksan
commited on
Commit
•
e945d50
1
Parent(s):
c346d0a
Add model files and tokenizer configuration; include special tokens and initialization settings
Browse files- main.py +84 -269
- models/merges.txt +0 -0
- models/poeticagpt.pth +3 -0
- models/special_tokens_map.json +24 -0
- models/tokenizer_config.json +22 -0
- models/vocab.json +0 -0
- poetry_generation.log +263 -0
main.py
CHANGED
@@ -1,21 +1,17 @@
|
|
1 |
import os
|
2 |
-
import
|
3 |
-
from typing import Optional, Dict, Any, Literal
|
4 |
from enum import Enum
|
5 |
from fastapi import FastAPI, HTTPException, status
|
6 |
from pathlib import Path
|
7 |
import logging
|
8 |
import sys
|
9 |
-
from pydantic import BaseModel, Field
|
10 |
-
|
11 |
-
from
|
|
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
-
MODEL_DIR = BASE_DIR / "models"
|
16 |
-
MODEL_NAME = "llama-2-7b-chat.q4_K_M.gguf"
|
17 |
-
MODEL_PATH = MODEL_DIR / MODEL_NAME
|
18 |
-
MODEL_URL = "https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf"
|
19 |
|
20 |
# Logging configuration
|
21 |
logging.basicConfig(
|
@@ -23,292 +19,106 @@ logging.basicConfig(
|
|
23 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
24 |
handlers=[
|
25 |
logging.StreamHandler(sys.stdout),
|
26 |
-
logging.FileHandler('
|
27 |
]
|
28 |
)
|
29 |
logger = logging.getLogger(__name__)
|
30 |
|
31 |
-
# Aligned with frontend enums
|
32 |
-
class PoemStyle(str, Enum):
|
33 |
-
SONNET = "sonnet"
|
34 |
-
HAIKU = "haiku"
|
35 |
-
FREE_VERSE = "free-verse"
|
36 |
-
VILLANELLE = "villanelle"
|
37 |
-
|
38 |
-
class EmotionalTone(str, Enum):
|
39 |
-
CONTEMPLATIVE = "contemplative"
|
40 |
-
JOYFUL = "joyful"
|
41 |
-
MELANCHOLIC = "melancholic"
|
42 |
-
ROMANTIC = "romantic"
|
43 |
-
|
44 |
-
class Length(str, Enum):
|
45 |
-
SHORT = "short"
|
46 |
-
MEDIUM = "medium"
|
47 |
-
LONG = "long"
|
48 |
-
|
49 |
-
@dataclass
|
50 |
-
class StyleConfig:
|
51 |
-
"""Maps style parameters to model parameters"""
|
52 |
-
temperature: float
|
53 |
-
top_p: float
|
54 |
-
top_k: int
|
55 |
-
repetition_penalty: float
|
56 |
-
max_tokens: int
|
57 |
-
|
58 |
-
class StyleMapper:
|
59 |
-
"""Maps style preferences to model parameters"""
|
60 |
-
|
61 |
-
@staticmethod
|
62 |
-
def get_style_config(
|
63 |
-
style: PoemStyle,
|
64 |
-
emotional_tone: EmotionalTone,
|
65 |
-
creative_style: float, # 0-100
|
66 |
-
language_variety: float, # 0-1
|
67 |
-
length: Length,
|
68 |
-
word_repetition: float, # 1-2
|
69 |
-
) -> StyleConfig:
|
70 |
-
# Base configuration
|
71 |
-
config = {
|
72 |
-
"temperature": 0.7,
|
73 |
-
"top_p": 0.9,
|
74 |
-
"top_k": 40,
|
75 |
-
"repetition_penalty": 1.1,
|
76 |
-
"max_tokens": 512
|
77 |
-
}
|
78 |
-
|
79 |
-
# Map creative_style (0-100) to temperature (0.5-1.0)
|
80 |
-
config["temperature"] = 0.5 + (creative_style / 100) * 0.5
|
81 |
-
|
82 |
-
# Map length to tokens (assuming average word is 5 tokens)
|
83 |
-
length_token_map = {
|
84 |
-
Length.SHORT: 500, # ~100 words
|
85 |
-
Length.MEDIUM: 1000, # ~200 words
|
86 |
-
Length.LONG: 1500, # ~300 words
|
87 |
-
}
|
88 |
-
config["max_tokens"] = length_token_map[length]
|
89 |
-
|
90 |
-
# Map language_variety (0-1) to top_p
|
91 |
-
config["top_p"] = 0.7 + (language_variety * 0.3)
|
92 |
-
|
93 |
-
# Map word_repetition (1-2) to repetition_penalty
|
94 |
-
config["repetition_penalty"] = word_repetition
|
95 |
-
|
96 |
-
# Adjust based on emotional tone
|
97 |
-
tone_temp_adjustment = {
|
98 |
-
EmotionalTone.CONTEMPLATIVE: 0.0,
|
99 |
-
EmotionalTone.JOYFUL: 0.1,
|
100 |
-
EmotionalTone.MELANCHOLIC: -0.1,
|
101 |
-
EmotionalTone.ROMANTIC: 0.2
|
102 |
-
}
|
103 |
-
config["temperature"] += tone_temp_adjustment[emotional_tone]
|
104 |
-
|
105 |
-
# Clamp temperature between 0.5 and 1.0
|
106 |
-
config["temperature"] = max(0.5, min(1.0, config["temperature"]))
|
107 |
-
|
108 |
-
return StyleConfig(**config)
|
109 |
-
|
110 |
class GenerateRequest(BaseModel):
|
111 |
-
prompt: str
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
word_repetition: float = Field(ge=1, le=2) # 1-2 slider
|
118 |
-
|
119 |
-
@validator('creative_style')
|
120 |
-
def validate_creative_style(cls, v):
|
121 |
-
if not 0 <= v <= 100:
|
122 |
-
raise ValueError('creative_style must be between 0 and 100')
|
123 |
-
return v
|
124 |
-
|
125 |
-
@validator('language_variety')
|
126 |
-
def validate_language_variety(cls, v):
|
127 |
-
if not 0 <= v <= 1:
|
128 |
-
raise ValueError('language_variety must be between 0 and 1')
|
129 |
-
return v
|
130 |
-
|
131 |
-
@validator('word_repetition')
|
132 |
-
def validate_word_repetition(cls, v):
|
133 |
-
if not 1 <= v <= 2:
|
134 |
-
raise ValueError('word_repetition must be between 1 and 2')
|
135 |
-
return v
|
136 |
-
|
137 |
-
|
138 |
-
class Config:
|
139 |
-
allow_population_by_field_name = True
|
140 |
-
|
141 |
|
142 |
class ModelManager:
|
143 |
def __init__(self):
|
144 |
self.model = None
|
|
|
145 |
|
146 |
-
def
|
147 |
-
"""
|
148 |
-
try:
|
149 |
-
MODEL_DIR.mkdir(parents=True, exist_ok=True)
|
150 |
-
|
151 |
-
# Verify directory exists and is writable
|
152 |
-
if not MODEL_DIR.exists():
|
153 |
-
raise RuntimeError(f"Failed to create directory: {MODEL_DIR}")
|
154 |
-
if not os.access(MODEL_DIR, os.W_OK):
|
155 |
-
raise RuntimeError(f"Directory not writable: {MODEL_DIR}")
|
156 |
-
|
157 |
-
logger.info(f"Model directory verified: {MODEL_DIR}")
|
158 |
-
except Exception as e:
|
159 |
-
logger.error(f"Error setting up model directory: {str(e)}")
|
160 |
-
raise
|
161 |
-
|
162 |
-
async def initialize(self):
|
163 |
-
"""Initialize the model with error handling"""
|
164 |
-
try:
|
165 |
-
# Ensure directory exists before attempting download
|
166 |
-
self.ensure_model_directory()
|
167 |
-
|
168 |
-
if not MODEL_PATH.exists():
|
169 |
-
await self.download_model()
|
170 |
-
|
171 |
-
self.model = self.initialize_model(MODEL_PATH)
|
172 |
-
return self.model is not None
|
173 |
-
except Exception as e:
|
174 |
-
logger.error(f"Initialization failed: {str(e)}")
|
175 |
-
return False
|
176 |
-
|
177 |
-
@staticmethod
|
178 |
-
async def download_model():
|
179 |
-
"""Download the model if it doesn't exist"""
|
180 |
-
import requests
|
181 |
-
from tqdm import tqdm
|
182 |
-
|
183 |
-
if MODEL_PATH.exists():
|
184 |
-
logger.info(f"Model already exists at {MODEL_PATH}")
|
185 |
-
return
|
186 |
-
|
187 |
-
# Create a temporary file for downloading
|
188 |
-
temp_path = MODEL_PATH.with_suffix('.temp')
|
189 |
-
|
190 |
-
logger.info(f"Downloading model to temporary file: {temp_path}")
|
191 |
try:
|
192 |
-
|
193 |
-
response.raise_for_status()
|
194 |
-
total_size = int(response.headers.get('content-length', 0))
|
195 |
-
|
196 |
-
# Ensure we have enough disk space
|
197 |
-
free_space = shutil.disk_usage(MODEL_DIR).free
|
198 |
-
if free_space < total_size * 1.1: # 10% buffer
|
199 |
-
raise RuntimeError(
|
200 |
-
f"Insufficient disk space. Need {total_size * 1.1 / (1024**3):.2f}GB, "
|
201 |
-
f"have {free_space / (1024**3):.2f}GB"
|
202 |
-
)
|
203 |
|
204 |
-
#
|
205 |
-
|
206 |
-
desc="Downloading",
|
207 |
-
total=total_size,
|
208 |
-
unit='iB',
|
209 |
-
unit_scale=True,
|
210 |
-
unit_divisor=1024,
|
211 |
-
) as pbar:
|
212 |
-
for data in response.iter_content(chunk_size=8192):
|
213 |
-
size = file.write(data)
|
214 |
-
pbar.update(size)
|
215 |
|
216 |
-
#
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
# Clean up partial download if it exists
|
233 |
-
if MODEL_PATH.exists():
|
234 |
-
MODEL_PATH.unlink()
|
235 |
-
raise RuntimeError(f"Model download failed: {str(e)}")
|
236 |
-
|
237 |
-
def initialize_model(self, model_path: Path):
|
238 |
-
"""Initialize the model with the specified configuration"""
|
239 |
-
try:
|
240 |
-
if not model_path.exists():
|
241 |
-
raise FileNotFoundError(f"Model file not found: {model_path}")
|
242 |
-
|
243 |
-
if not model_path.is_file():
|
244 |
-
raise RuntimeError(f"Model path is not a file: {model_path}")
|
245 |
|
246 |
-
|
247 |
-
|
248 |
|
249 |
-
|
250 |
-
model
|
251 |
-
|
252 |
-
model_file=model_path.name,
|
253 |
-
model_type="llama",
|
254 |
-
max_new_tokens=1500,
|
255 |
-
context_length=2048,
|
256 |
-
gpu_layers=0
|
257 |
-
)
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
logger.info("Model initialized successfully")
|
263 |
-
return model
|
264 |
|
265 |
except Exception as e:
|
266 |
logger.error(f"Error initializing model: {str(e)}")
|
267 |
-
|
|
|
268 |
|
269 |
def generate(self, request: GenerateRequest) -> Dict[str, Any]:
|
270 |
-
"""Generate
|
271 |
-
if self.model is None:
|
272 |
raise HTTPException(
|
273 |
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
274 |
-
detail="Model not loaded"
|
275 |
)
|
276 |
|
277 |
-
# Get style configuration
|
278 |
-
style_config = StyleMapper.get_style_config(
|
279 |
-
request.style,
|
280 |
-
request.emotional_tone,
|
281 |
-
request.creative_style,
|
282 |
-
request.language_variety,
|
283 |
-
request.length,
|
284 |
-
request.word_repetition
|
285 |
-
)
|
286 |
-
|
287 |
try:
|
288 |
-
#
|
289 |
-
|
290 |
-
|
291 |
-
PoemStyle.HAIKU: "Write a haiku about",
|
292 |
-
PoemStyle.FREE_VERSE: "Write a free verse poem about",
|
293 |
-
PoemStyle.VILLANELLE: "Write a villanelle about"
|
294 |
-
}
|
295 |
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
|
298 |
-
|
299 |
-
styled_prompt,
|
300 |
-
max_new_tokens=style_config.max_tokens,
|
301 |
-
temperature=style_config.temperature,
|
302 |
-
top_p=style_config.top_p,
|
303 |
-
top_k=style_config.top_k,
|
304 |
-
repetition_penalty=style_config.repetition_penalty
|
305 |
-
)
|
306 |
|
307 |
return {
|
308 |
-
"generated_text":
|
309 |
-
"prompt":
|
310 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
|
|
312 |
except Exception as e:
|
313 |
logger.error(f"Error generating text: {str(e)}")
|
314 |
raise HTTPException(
|
@@ -323,23 +133,28 @@ model_manager = ModelManager()
|
|
323 |
@app.on_event("startup")
|
324 |
async def startup():
|
325 |
"""Initialize the model during startup"""
|
326 |
-
|
|
|
|
|
327 |
|
328 |
@app.get("/health")
|
329 |
async def health_check():
|
330 |
"""Health check endpoint"""
|
331 |
return {
|
332 |
"status": "healthy",
|
333 |
-
"model_loaded": model_manager.model is not None
|
|
|
334 |
}
|
335 |
|
336 |
@app.post("/generate")
|
337 |
async def generate_text(request: GenerateRequest):
|
338 |
-
"""Generate
|
339 |
return model_manager.generate(request)
|
340 |
|
341 |
@app.on_event("shutdown")
|
342 |
async def shutdown():
|
343 |
"""Cleanup on shutdown"""
|
344 |
if model_manager.model is not None:
|
345 |
-
del model_manager.model
|
|
|
|
|
|
1 |
import os
|
2 |
+
from typing import Optional, Dict, Any
|
|
|
3 |
from enum import Enum
|
4 |
from fastapi import FastAPI, HTTPException, status
|
5 |
from pathlib import Path
|
6 |
import logging
|
7 |
import sys
|
8 |
+
from pydantic import BaseModel, Field
|
9 |
+
import torch
|
10 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
11 |
+
import json
|
12 |
|
13 |
+
# Define base model directory
|
14 |
+
BASE_MODEL_DIR = "./models/"
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# Logging configuration
|
17 |
logging.basicConfig(
|
|
|
19 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
20 |
handlers=[
|
21 |
logging.StreamHandler(sys.stdout),
|
22 |
+
logging.FileHandler('poetry_generation.log')
|
23 |
]
|
24 |
)
|
25 |
logger = logging.getLogger(__name__)
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
class GenerateRequest(BaseModel):
|
28 |
+
prompt: str = Field(..., min_length=1, max_length=500)
|
29 |
+
max_length: Optional[int] = Field(default=100, ge=10, le=500)
|
30 |
+
temperature: float = Field(default=0.9, ge=0.1, le=2.0)
|
31 |
+
top_k: int = Field(default=50, ge=1, le=100)
|
32 |
+
top_p: float = Field(default=0.95, ge=0.1, le=1.0)
|
33 |
+
repetition_penalty: float = Field(default=1.2, ge=1.0, le=2.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
class ModelManager:
|
36 |
def __init__(self):
|
37 |
self.model = None
|
38 |
+
self.tokenizer = None
|
39 |
|
40 |
+
def initialize(self):
|
41 |
+
"""Initialize the model and tokenizer"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
try:
|
43 |
+
logger.info("Loading tokenizer...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
# First, let's try to load the base GPT-2 tokenizer
|
46 |
+
self.tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
# Now customize it with your vocabulary if needed
|
49 |
+
vocab_path = os.path.join(BASE_MODEL_DIR, "vocab.json")
|
50 |
+
if os.path.exists(vocab_path):
|
51 |
+
try:
|
52 |
+
with open(vocab_path, 'r', encoding='utf-8') as f:
|
53 |
+
custom_vocab = json.load(f)
|
54 |
+
self.tokenizer.vocab = custom_vocab
|
55 |
+
self.tokenizer.ids_to_tokens = {v: k for k, v in custom_vocab.items()}
|
56 |
+
except Exception as e:
|
57 |
+
logger.warning(f"Could not load custom vocabulary: {str(e)}")
|
58 |
|
59 |
+
logger.info("Loading model...")
|
60 |
+
model_path = os.path.join(BASE_MODEL_DIR, "poeticagpt.pth")
|
61 |
+
if not os.path.exists(model_path):
|
62 |
+
logger.error(f"Model file not found at {model_path}")
|
63 |
+
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
# Load the model weights
|
66 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_path, local_files_only=True)
|
67 |
|
68 |
+
# Force model to CPU
|
69 |
+
self.model.to('cpu')
|
70 |
+
self.model.eval()
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
logger.info("Model and tokenizer loaded successfully")
|
73 |
+
return True
|
|
|
|
|
|
|
74 |
|
75 |
except Exception as e:
|
76 |
logger.error(f"Error initializing model: {str(e)}")
|
77 |
+
logger.exception("Detailed traceback:")
|
78 |
+
return False
|
79 |
|
80 |
def generate(self, request: GenerateRequest) -> Dict[str, Any]:
|
81 |
+
"""Generate poetry based on the request parameters"""
|
82 |
+
if self.model is None or self.tokenizer is None:
|
83 |
raise HTTPException(
|
84 |
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
85 |
+
detail="Model or tokenizer not loaded"
|
86 |
)
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
try:
|
89 |
+
# Encode input
|
90 |
+
inputs = self.tokenizer.encode(request.prompt, return_tensors='pt')
|
91 |
+
attention_mask = torch.ones(inputs.shape, dtype=torch.long)
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
# Generate
|
94 |
+
with torch.no_grad():
|
95 |
+
outputs = self.model.generate(
|
96 |
+
inputs,
|
97 |
+
attention_mask=attention_mask,
|
98 |
+
max_length=request.max_length,
|
99 |
+
num_return_sequences=1,
|
100 |
+
temperature=request.temperature,
|
101 |
+
top_k=request.top_k,
|
102 |
+
top_p=request.top_p,
|
103 |
+
repetition_penalty=request.repetition_penalty,
|
104 |
+
do_sample=True,
|
105 |
+
pad_token_id=self.tokenizer.eos_token_id,
|
106 |
+
)
|
107 |
|
108 |
+
generated_text = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
return {
|
111 |
+
"generated_text": generated_text,
|
112 |
+
"prompt": request.prompt,
|
113 |
+
"parameters": {
|
114 |
+
"max_length": request.max_length,
|
115 |
+
"temperature": request.temperature,
|
116 |
+
"top_k": request.top_k,
|
117 |
+
"top_p": request.top_p,
|
118 |
+
"repetition_penalty": request.repetition_penalty
|
119 |
+
}
|
120 |
}
|
121 |
+
|
122 |
except Exception as e:
|
123 |
logger.error(f"Error generating text: {str(e)}")
|
124 |
raise HTTPException(
|
|
|
133 |
@app.on_event("startup")
|
134 |
async def startup():
|
135 |
"""Initialize the model during startup"""
|
136 |
+
if not model_manager.initialize():
|
137 |
+
logger.error("Failed to initialize model manager")
|
138 |
+
sys.exit(1)
|
139 |
|
140 |
@app.get("/health")
|
141 |
async def health_check():
|
142 |
"""Health check endpoint"""
|
143 |
return {
|
144 |
"status": "healthy",
|
145 |
+
"model_loaded": model_manager.model is not None,
|
146 |
+
"tokenizer_loaded": model_manager.tokenizer is not None
|
147 |
}
|
148 |
|
149 |
@app.post("/generate")
|
150 |
async def generate_text(request: GenerateRequest):
|
151 |
+
"""Generate poetry with parameters"""
|
152 |
return model_manager.generate(request)
|
153 |
|
154 |
@app.on_event("shutdown")
|
155 |
async def shutdown():
|
156 |
"""Cleanup on shutdown"""
|
157 |
if model_manager.model is not None:
|
158 |
+
del model_manager.model
|
159 |
+
if model_manager.tokenizer is not None:
|
160 |
+
del model_manager.tokenizer
|
models/merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
models/poeticagpt.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f77da9534fcf01b36f4780cd24ebe46e4d7f8740a1b17b66d5173d8694d6a62e
|
3 |
+
size 139310252
|
models/special_tokens_map.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<|endoftext|>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|endoftext|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": "<|endoftext|>",
|
17 |
+
"unk_token": {
|
18 |
+
"content": "<|endoftext|>",
|
19 |
+
"lstrip": false,
|
20 |
+
"normalized": true,
|
21 |
+
"rstrip": false,
|
22 |
+
"single_word": false
|
23 |
+
}
|
24 |
+
}
|
models/tokenizer_config.json
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": false,
|
3 |
+
"add_prefix_space": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"50256": {
|
6 |
+
"content": "<|endoftext|>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
}
|
13 |
+
},
|
14 |
+
"bos_token": "<|endoftext|>",
|
15 |
+
"clean_up_tokenization_spaces": false,
|
16 |
+
"eos_token": "<|endoftext|>",
|
17 |
+
"errors": "replace",
|
18 |
+
"model_max_length": 1024,
|
19 |
+
"pad_token": "<|endoftext|>",
|
20 |
+
"tokenizer_class": "GPT2Tokenizer",
|
21 |
+
"unk_token": "<|endoftext|>"
|
22 |
+
}
|
models/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
poetry_generation.log
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2024-11-16 23:03:13,077 - main - INFO - Loading tokenizer...
|
2 |
+
2024-11-16 23:03:13,077 - main - ERROR - Error initializing model: Incorrect path_or_model_id: '\poetica'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
3 |
+
2024-11-16 23:03:13,078 - main - ERROR - Failed to initialize model manager
|
4 |
+
2024-11-16 23:03:48,134 - main - INFO - Loading tokenizer...
|
5 |
+
2024-11-16 23:03:48,135 - main - ERROR - Error initializing model: \ does not appear to have a file named config.json. Checkout 'https://huggingface.co/\/tree/None' for available files.
|
6 |
+
2024-11-16 23:03:48,135 - main - ERROR - Failed to initialize model manager
|
7 |
+
2024-11-16 23:05:52,528 - main - INFO - Loading tokenizer...
|
8 |
+
2024-11-16 23:05:52,530 - main - ERROR - Error initializing model: Incorrect path_or_model_id: './models/tokenizer_config.json'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
9 |
+
2024-11-16 23:05:52,530 - main - ERROR - Failed to initialize model manager
|
10 |
+
2024-11-16 23:06:20,012 - main - INFO - Loading tokenizer...
|
11 |
+
2024-11-16 23:06:20,012 - main - ERROR - Error initializing model: Incorrect path_or_model_id: './models/tokenizer_config.json'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
12 |
+
2024-11-16 23:06:20,012 - main - ERROR - Failed to initialize model manager
|
13 |
+
2024-11-16 23:07:40,051 - main - INFO - Loading tokenizer...
|
14 |
+
2024-11-16 23:07:40,135 - main - ERROR - Error initializing model: expected str, bytes or os.PathLike object, not NoneType
|
15 |
+
2024-11-16 23:07:40,136 - main - ERROR - Detailed traceback:
|
16 |
+
Traceback (most recent call last):
|
17 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 64, in initialize
|
18 |
+
self.tokenizer = AutoTokenizer.from_pretrained(
|
19 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
20 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\auto\tokenization_auto.py", line 896, in from_pretrained
|
21 |
+
return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
|
22 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
23 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 2291, in from_pretrained
|
24 |
+
return cls._from_pretrained(
|
25 |
+
^^^^^^^^^^^^^^^^^^^^^
|
26 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 2329, in _from_pretrained
|
27 |
+
slow_tokenizer = (cls.slow_tokenizer_class)._from_pretrained(
|
28 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
29 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 2525, in _from_pretrained
|
30 |
+
tokenizer = cls(*init_inputs, **init_kwargs)
|
31 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
32 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\gpt2\tokenization_gpt2.py", line 159, in __init__
|
33 |
+
with open(merges_file, encoding="utf-8") as merges_handle:
|
34 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
35 |
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
|
36 |
+
2024-11-16 23:07:40,163 - main - ERROR - Failed to initialize model manager
|
37 |
+
2024-11-16 23:07:56,229 - main - INFO - Loading tokenizer...
|
38 |
+
2024-11-16 23:07:56,274 - main - ERROR - Error initializing model: expected str, bytes or os.PathLike object, not NoneType
|
39 |
+
2024-11-16 23:07:56,275 - main - ERROR - Detailed traceback:
|
40 |
+
Traceback (most recent call last):
|
41 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 64, in initialize
|
42 |
+
self.tokenizer = AutoTokenizer.from_pretrained(
|
43 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
44 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\auto\tokenization_auto.py", line 896, in from_pretrained
|
45 |
+
return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
|
46 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
47 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 2291, in from_pretrained
|
48 |
+
return cls._from_pretrained(
|
49 |
+
^^^^^^^^^^^^^^^^^^^^^
|
50 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 2329, in _from_pretrained
|
51 |
+
slow_tokenizer = (cls.slow_tokenizer_class)._from_pretrained(
|
52 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
53 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 2525, in _from_pretrained
|
54 |
+
tokenizer = cls(*init_inputs, **init_kwargs)
|
55 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
56 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\gpt2\tokenization_gpt2.py", line 159, in __init__
|
57 |
+
with open(merges_file, encoding="utf-8") as merges_handle:
|
58 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
59 |
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
|
60 |
+
2024-11-16 23:07:56,280 - main - ERROR - Failed to initialize model manager
|
61 |
+
2024-11-16 23:09:15,013 - main - INFO - Loading tokenizer...
|
62 |
+
2024-11-16 23:09:15,021 - main - ERROR - Error initializing model: expected `,` or `}` at line 2 column 18
|
63 |
+
2024-11-16 23:09:15,021 - main - ERROR - Detailed traceback:
|
64 |
+
Traceback (most recent call last):
|
65 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 80, in initialize
|
66 |
+
self.tokenizer = GPT2TokenizerFast(
|
67 |
+
^^^^^^^^^^^^^^^^^^
|
68 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\gpt2\tokenization_gpt2_fast.py", line 99, in __init__
|
69 |
+
super().__init__(
|
70 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_fast.py", line 115, in __init__
|
71 |
+
fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
|
72 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
73 |
+
Exception: expected `,` or `}` at line 2 column 18
|
74 |
+
2024-11-16 23:09:15,022 - main - ERROR - Failed to initialize model manager
|
75 |
+
2024-11-16 23:09:32,778 - main - INFO - Loading tokenizer...
|
76 |
+
2024-11-16 23:09:32,778 - main - ERROR - Error initializing model: expected `,` or `}` at line 2 column 18
|
77 |
+
2024-11-16 23:09:32,779 - main - ERROR - Detailed traceback:
|
78 |
+
Traceback (most recent call last):
|
79 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 80, in initialize
|
80 |
+
self.tokenizer = GPT2TokenizerFast(
|
81 |
+
^^^^^^^^^^^^^^^^^^
|
82 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\gpt2\tokenization_gpt2_fast.py", line 99, in __init__
|
83 |
+
super().__init__(
|
84 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\tokenization_utils_fast.py", line 115, in __init__
|
85 |
+
fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
|
86 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
87 |
+
Exception: expected `,` or `}` at line 2 column 18
|
88 |
+
2024-11-16 23:09:32,780 - main - ERROR - Failed to initialize model manager
|
89 |
+
2024-11-16 23:10:31,968 - main - INFO - Loading tokenizer...
|
90 |
+
2024-11-16 23:10:31,978 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
91 |
+
2024-11-16 23:10:32,575 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
92 |
+
2024-11-16 23:10:32,579 - filelock - DEBUG - Attempting to acquire lock 3194343144000 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\be4d21d94f3b4687e5a54d84bf6ab46ed0f8defd.lock
|
93 |
+
2024-11-16 23:10:32,580 - filelock - DEBUG - Lock 3194343144000 acquired on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\be4d21d94f3b4687e5a54d84bf6ab46ed0f8defd.lock
|
94 |
+
2024-11-16 23:10:33,328 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 26
|
95 |
+
2024-11-16 23:10:33,362 - filelock - DEBUG - Attempting to release lock 3194343144000 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\be4d21d94f3b4687e5a54d84bf6ab46ed0f8defd.lock
|
96 |
+
2024-11-16 23:10:33,363 - filelock - DEBUG - Lock 3194343144000 released on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\be4d21d94f3b4687e5a54d84bf6ab46ed0f8defd.lock
|
97 |
+
2024-11-16 23:10:33,624 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/config.json HTTP/11" 200 0
|
98 |
+
2024-11-16 23:10:33,631 - filelock - DEBUG - Attempting to acquire lock 3194374134560 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\10c66461e4c109db5a2196bff4bb59be30396ed8.lock
|
99 |
+
2024-11-16 23:10:33,632 - filelock - DEBUG - Lock 3194374134560 acquired on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\10c66461e4c109db5a2196bff4bb59be30396ed8.lock
|
100 |
+
2024-11-16 23:10:33,922 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /gpt2/resolve/main/config.json HTTP/11" 200 665
|
101 |
+
2024-11-16 23:10:33,926 - filelock - DEBUG - Attempting to release lock 3194374134560 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\10c66461e4c109db5a2196bff4bb59be30396ed8.lock
|
102 |
+
2024-11-16 23:10:33,926 - filelock - DEBUG - Lock 3194374134560 released on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\10c66461e4c109db5a2196bff4bb59be30396ed8.lock
|
103 |
+
2024-11-16 23:10:34,218 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/vocab.json HTTP/11" 200 0
|
104 |
+
2024-11-16 23:10:34,219 - filelock - DEBUG - Attempting to acquire lock 3194378990896 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\1f1d9aaca301414e7f6c9396df506798ff4eb9a6.lock
|
105 |
+
2024-11-16 23:10:34,220 - filelock - DEBUG - Lock 3194378990896 acquired on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\1f1d9aaca301414e7f6c9396df506798ff4eb9a6.lock
|
106 |
+
2024-11-16 23:10:34,475 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /gpt2/resolve/main/vocab.json HTTP/11" 200 1042301
|
107 |
+
2024-11-16 23:10:35,729 - filelock - DEBUG - Attempting to release lock 3194378990896 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\1f1d9aaca301414e7f6c9396df506798ff4eb9a6.lock
|
108 |
+
2024-11-16 23:10:35,729 - filelock - DEBUG - Lock 3194378990896 released on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\1f1d9aaca301414e7f6c9396df506798ff4eb9a6.lock
|
109 |
+
2024-11-16 23:10:36,400 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/merges.txt HTTP/11" 200 0
|
110 |
+
2024-11-16 23:10:36,402 - filelock - DEBUG - Attempting to acquire lock 3194378990896 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\226b0752cac7789c48f0cb3ec53eda48b7be36cc.lock
|
111 |
+
2024-11-16 23:10:36,403 - filelock - DEBUG - Lock 3194378990896 acquired on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\226b0752cac7789c48f0cb3ec53eda48b7be36cc.lock
|
112 |
+
2024-11-16 23:10:36,670 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /gpt2/resolve/main/merges.txt HTTP/11" 200 456318
|
113 |
+
2024-11-16 23:10:36,918 - filelock - DEBUG - Attempting to release lock 3194378990896 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\226b0752cac7789c48f0cb3ec53eda48b7be36cc.lock
|
114 |
+
2024-11-16 23:10:36,919 - filelock - DEBUG - Lock 3194378990896 released on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\226b0752cac7789c48f0cb3ec53eda48b7be36cc.lock
|
115 |
+
2024-11-16 23:10:37,180 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer.json HTTP/11" 200 0
|
116 |
+
2024-11-16 23:10:37,183 - filelock - DEBUG - Attempting to acquire lock 3194378979184 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\4b988bccc9dc5adacd403c00b4704976196548f8.lock
|
117 |
+
2024-11-16 23:10:37,184 - filelock - DEBUG - Lock 3194378979184 acquired on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\4b988bccc9dc5adacd403c00b4704976196548f8.lock
|
118 |
+
2024-11-16 23:10:37,879 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /gpt2/resolve/main/tokenizer.json HTTP/11" 200 1355256
|
119 |
+
2024-11-16 23:10:39,156 - filelock - DEBUG - Attempting to release lock 3194378979184 on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\4b988bccc9dc5adacd403c00b4704976196548f8.lock
|
120 |
+
2024-11-16 23:10:39,157 - filelock - DEBUG - Lock 3194378979184 released on C:\Users\asus\.cache\huggingface\hub\.locks\models--gpt2\4b988bccc9dc5adacd403c00b4704976196548f8.lock
|
121 |
+
2024-11-16 23:10:39,435 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/added_tokens.json HTTP/11" 404 0
|
122 |
+
2024-11-16 23:10:39,694 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/special_tokens_map.json HTTP/11" 404 0
|
123 |
+
2024-11-16 23:10:39,884 - main - WARNING - Could not load custom vocabulary: property 'vocab' of 'GPT2TokenizerFast' object has no setter
|
124 |
+
2024-11-16 23:10:39,884 - main - INFO - Loading model...
|
125 |
+
2024-11-16 23:10:39,885 - main - ERROR - Error initializing model: Incorrect path_or_model_id: './models\poeticagpt-quantized-new.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
126 |
+
2024-11-16 23:10:39,885 - main - ERROR - Detailed traceback:
|
127 |
+
Traceback (most recent call last):
|
128 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 402, in cached_file
|
129 |
+
resolved_file = hf_hub_download(
|
130 |
+
^^^^^^^^^^^^^^^^
|
131 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 106, in _inner_fn
|
132 |
+
validate_repo_id(arg_value)
|
133 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 160, in validate_repo_id
|
134 |
+
raise HFValidationError(
|
135 |
+
huggingface_hub.errors.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: './models\poeticagpt-quantized-new.pth'.
|
136 |
+
|
137 |
+
The above exception was the direct cause of the following exception:
|
138 |
+
|
139 |
+
Traceback (most recent call last):
|
140 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 66, in initialize
|
141 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_path, local_files_only=True)
|
142 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
143 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\auto\auto_factory.py", line 485, in from_pretrained
|
144 |
+
resolved_config_file = cached_file(
|
145 |
+
^^^^^^^^^^^^
|
146 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 466, in cached_file
|
147 |
+
raise EnvironmentError(
|
148 |
+
OSError: Incorrect path_or_model_id: './models\poeticagpt-quantized-new.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
149 |
+
2024-11-16 23:10:39,916 - main - ERROR - Failed to initialize model manager
|
150 |
+
2024-11-16 23:11:46,212 - main - INFO - Loading tokenizer...
|
151 |
+
2024-11-16 23:11:46,216 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
152 |
+
2024-11-16 23:11:47,226 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
153 |
+
2024-11-16 23:11:47,382 - main - WARNING - Could not load custom vocabulary: property 'vocab' of 'GPT2TokenizerFast' object has no setter
|
154 |
+
2024-11-16 23:11:47,382 - main - INFO - Loading model...
|
155 |
+
2024-11-16 23:11:47,383 - main - ERROR - Error initializing model: Incorrect path_or_model_id: './models/poeticagpt-quantized-new.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
156 |
+
2024-11-16 23:11:47,383 - main - ERROR - Detailed traceback:
|
157 |
+
Traceback (most recent call last):
|
158 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 402, in cached_file
|
159 |
+
resolved_file = hf_hub_download(
|
160 |
+
^^^^^^^^^^^^^^^^
|
161 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 106, in _inner_fn
|
162 |
+
validate_repo_id(arg_value)
|
163 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 154, in validate_repo_id
|
164 |
+
raise HFValidationError(
|
165 |
+
huggingface_hub.errors.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './models/poeticagpt-quantized-new.pth'. Use `repo_type` argument if needed.
|
166 |
+
|
167 |
+
The above exception was the direct cause of the following exception:
|
168 |
+
|
169 |
+
Traceback (most recent call last):
|
170 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 66, in initialize
|
171 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_path, local_files_only=True)
|
172 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
173 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\auto\auto_factory.py", line 485, in from_pretrained
|
174 |
+
resolved_config_file = cached_file(
|
175 |
+
^^^^^^^^^^^^
|
176 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 466, in cached_file
|
177 |
+
raise EnvironmentError(
|
178 |
+
OSError: Incorrect path_or_model_id: './models/poeticagpt-quantized-new.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
179 |
+
2024-11-16 23:11:47,386 - main - ERROR - Failed to initialize model manager
|
180 |
+
2024-11-16 23:12:20,475 - main - INFO - Loading tokenizer...
|
181 |
+
2024-11-16 23:12:20,478 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
182 |
+
2024-11-16 23:12:21,010 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
183 |
+
2024-11-16 23:12:21,169 - main - WARNING - Could not load custom vocabulary: property 'vocab' of 'GPT2TokenizerFast' object has no setter
|
184 |
+
2024-11-16 23:12:21,169 - main - INFO - Loading model...
|
185 |
+
2024-11-16 23:12:21,170 - main - ERROR - Error initializing model: Incorrect path_or_model_id: './models/poeticagpt.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
186 |
+
2024-11-16 23:12:21,170 - main - ERROR - Detailed traceback:
|
187 |
+
Traceback (most recent call last):
|
188 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 402, in cached_file
|
189 |
+
resolved_file = hf_hub_download(
|
190 |
+
^^^^^^^^^^^^^^^^
|
191 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 106, in _inner_fn
|
192 |
+
validate_repo_id(arg_value)
|
193 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 154, in validate_repo_id
|
194 |
+
raise HFValidationError(
|
195 |
+
huggingface_hub.errors.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './models/poeticagpt.pth'. Use `repo_type` argument if needed.
|
196 |
+
|
197 |
+
The above exception was the direct cause of the following exception:
|
198 |
+
|
199 |
+
Traceback (most recent call last):
|
200 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 66, in initialize
|
201 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_path, local_files_only=True)
|
202 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
203 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\auto\auto_factory.py", line 485, in from_pretrained
|
204 |
+
resolved_config_file = cached_file(
|
205 |
+
^^^^^^^^^^^^
|
206 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 466, in cached_file
|
207 |
+
raise EnvironmentError(
|
208 |
+
OSError: Incorrect path_or_model_id: './models/poeticagpt.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
209 |
+
2024-11-16 23:12:21,173 - main - ERROR - Failed to initialize model manager
|
210 |
+
2024-11-16 23:13:01,527 - main - INFO - Loading tokenizer...
|
211 |
+
2024-11-16 23:13:01,531 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
212 |
+
2024-11-16 23:13:02,097 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
213 |
+
2024-11-16 23:13:02,216 - main - INFO - Loading model...
|
214 |
+
2024-11-16 23:13:02,217 - main - ERROR - Model file not found at poetica\models\poeticagpt.pth\poeticagpt.pth
|
215 |
+
2024-11-16 23:13:02,217 - main - ERROR - Failed to initialize model manager
|
216 |
+
2024-11-16 23:13:08,762 - main - INFO - Loading tokenizer...
|
217 |
+
2024-11-16 23:13:08,765 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
218 |
+
2024-11-16 23:13:09,732 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
219 |
+
2024-11-16 23:13:09,845 - main - INFO - Loading model...
|
220 |
+
2024-11-16 23:13:09,846 - main - ERROR - Model file not found at poetica\models\poeticagpt.pth
|
221 |
+
2024-11-16 23:13:09,846 - main - ERROR - Failed to initialize model manager
|
222 |
+
2024-11-16 23:13:33,649 - main - INFO - Loading tokenizer...
|
223 |
+
2024-11-16 23:13:33,652 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
224 |
+
2024-11-16 23:13:34,215 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
225 |
+
2024-11-16 23:13:34,334 - main - INFO - Loading model...
|
226 |
+
2024-11-16 23:13:34,335 - main - ERROR - Model file not found at .\poeticagpt.pth
|
227 |
+
2024-11-16 23:13:34,335 - main - ERROR - Failed to initialize model manager
|
228 |
+
2024-11-16 23:14:10,849 - main - INFO - Loading tokenizer...
|
229 |
+
2024-11-16 23:14:10,852 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
230 |
+
2024-11-16 23:14:11,883 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
231 |
+
2024-11-16 23:14:12,000 - main - INFO - Loading model...
|
232 |
+
2024-11-16 23:14:12,001 - main - ERROR - Error initializing model: Incorrect path_or_model_id: './poeticagpt.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
233 |
+
2024-11-16 23:14:12,001 - main - ERROR - Detailed traceback:
|
234 |
+
Traceback (most recent call last):
|
235 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 402, in cached_file
|
236 |
+
resolved_file = hf_hub_download(
|
237 |
+
^^^^^^^^^^^^^^^^
|
238 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 106, in _inner_fn
|
239 |
+
validate_repo_id(arg_value)
|
240 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\huggingface_hub\utils\_validators.py", line 160, in validate_repo_id
|
241 |
+
raise HFValidationError(
|
242 |
+
huggingface_hub.errors.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: './poeticagpt.pth'.
|
243 |
+
|
244 |
+
The above exception was the direct cause of the following exception:
|
245 |
+
|
246 |
+
Traceback (most recent call last):
|
247 |
+
File "E:\Self Work\My Projects\Poetica HuggingFace Server\poetica\main.py", line 66, in initialize
|
248 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_path, local_files_only=True)
|
249 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
250 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\models\auto\auto_factory.py", line 485, in from_pretrained
|
251 |
+
resolved_config_file = cached_file(
|
252 |
+
^^^^^^^^^^^^
|
253 |
+
File "e:\Self Work\My Projects\Poetica HuggingFace Server\.venv\Lib\site-packages\transformers\utils\hub.py", line 466, in cached_file
|
254 |
+
raise EnvironmentError(
|
255 |
+
OSError: Incorrect path_or_model_id: './poeticagpt.pth'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
|
256 |
+
2024-11-16 23:14:12,003 - main - ERROR - Failed to initialize model manager
|
257 |
+
2024-11-16 23:14:22,432 - main - INFO - Loading tokenizer...
|
258 |
+
2024-11-16 23:14:22,435 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
|
259 |
+
2024-11-16 23:14:22,975 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /gpt2/resolve/main/tokenizer_config.json HTTP/11" 200 0
|
260 |
+
2024-11-16 23:14:23,132 - main - WARNING - Could not load custom vocabulary: property 'vocab' of 'GPT2TokenizerFast' object has no setter
|
261 |
+
2024-11-16 23:14:23,132 - main - INFO - Loading model...
|
262 |
+
2024-11-16 23:14:23,132 - main - ERROR - Model file not found at ./models/poeticagpt.pth
|
263 |
+
2024-11-16 23:14:23,134 - main - ERROR - Failed to initialize model manager
|