@lzhzzzzwill/cofos 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cofos.js +2 -0
- package/package.json +1 -1
- package/scripts/chat.py +24 -4
package/bin/cofos.js
CHANGED
|
@@ -172,6 +172,8 @@ function main() {
|
|
|
172
172
|
HF_HUB_ENABLE_HF_TRANSFER: process.env.HF_HUB_ENABLE_HF_TRANSFER || "0",
|
|
173
173
|
HF_HUB_DOWNLOAD_TIMEOUT: process.env.HF_HUB_DOWNLOAD_TIMEOUT || "120",
|
|
174
174
|
HF_HUB_ETAG_TIMEOUT: process.env.HF_HUB_ETAG_TIMEOUT || "30",
|
|
175
|
+
HF_HUB_VERBOSITY: process.env.HF_HUB_VERBOSITY || "warning",
|
|
176
|
+
TRANSFORMERS_VERBOSITY: process.env.TRANSFORMERS_VERBOSITY || "warning",
|
|
175
177
|
};
|
|
176
178
|
const proc = spawn(py, backendArgs, {
|
|
177
179
|
stdio: ["pipe", "pipe", "pipe"],
|
package/package.json
CHANGED
package/scripts/chat.py
CHANGED
|
@@ -24,6 +24,8 @@ os.environ.setdefault("HF_HUB_DISABLE_XET", "1")
|
|
|
24
24
|
os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "0")
|
|
25
25
|
os.environ.setdefault("HF_HUB_DOWNLOAD_TIMEOUT", "120")
|
|
26
26
|
os.environ.setdefault("HF_HUB_ETAG_TIMEOUT", "30")
|
|
27
|
+
os.environ.setdefault("HF_HUB_VERBOSITY", "warning")
|
|
28
|
+
os.environ.setdefault("TRANSFORMERS_VERBOSITY", "warning")
|
|
27
29
|
|
|
28
30
|
HISTORY_FILE = os.path.join(os.path.expanduser("~"), ".cofos_history.jsonl")
|
|
29
31
|
HISTORY_MAX_TURNS = 20
|
|
@@ -338,19 +340,35 @@ def ensure_runtime_data(project_root: Path, config: dict) -> None:
|
|
|
338
340
|
"runtime/bm25/bm25_info.json": bm25_dir,
|
|
339
341
|
}
|
|
340
342
|
|
|
343
|
+
missing_items = []
|
|
341
344
|
for remote_path, target_dir in file_map.items():
|
|
342
|
-
target_dir.mkdir(parents=True, exist_ok=True)
|
|
343
345
|
local_name = remote_path.rsplit("/", 1)[-1]
|
|
344
346
|
local_path = target_dir / local_name
|
|
345
|
-
if local_path.exists():
|
|
346
|
-
|
|
347
|
+
if not local_path.exists():
|
|
348
|
+
missing_items.append((remote_path, target_dir, local_path))
|
|
349
|
+
|
|
350
|
+
total = len(missing_items)
|
|
351
|
+
if total == 0:
|
|
352
|
+
print("[chat] Runtime data ready.", file=sys.stderr, flush=True)
|
|
353
|
+
return
|
|
354
|
+
|
|
355
|
+
def progress_line(index: int, remote_path: str) -> str:
|
|
356
|
+
width = 18
|
|
357
|
+
filled = int(width * index / total)
|
|
358
|
+
bar = "#" * filled + "-" * (width - filled)
|
|
359
|
+
pct = int(100 * index / total)
|
|
360
|
+
return f"[chat] Runtime data [{index}/{total}] [{bar}] {pct:3d}% {remote_path}"
|
|
361
|
+
|
|
362
|
+
for index, (remote_path, target_dir, local_path) in enumerate(missing_items, 1):
|
|
363
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
364
|
+
print(progress_line(index, remote_path), file=sys.stderr, flush=True)
|
|
347
365
|
cached = hf_hub_download(
|
|
348
366
|
repo_id=repo,
|
|
349
367
|
repo_type="dataset",
|
|
350
368
|
filename=remote_path,
|
|
351
369
|
)
|
|
352
370
|
shutil.copy2(cached, local_path)
|
|
353
|
-
print(f"[chat]
|
|
371
|
+
print(f"[chat] -> {local_path}", file=sys.stderr, flush=True)
|
|
354
372
|
|
|
355
373
|
print("[chat] Runtime data ready.", file=sys.stderr, flush=True)
|
|
356
374
|
|
|
@@ -446,6 +464,8 @@ def main() -> None:
|
|
|
446
464
|
from inference.student_adapter_inference import StudentAdapterInference, StudentRAGContext
|
|
447
465
|
|
|
448
466
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
467
|
+
for noisy_logger in ("httpx", "httpcore", "huggingface_hub"):
|
|
468
|
+
logging.getLogger(noisy_logger).setLevel(logging.WARNING)
|
|
449
469
|
|
|
450
470
|
config_path = default_config_path(runtime_root) if args.config == DEFAULT_CONFIG else resolve_project_path(runtime_root, args.config)
|
|
451
471
|
model_path = resolve_project_path(runtime_root, args.model_path)
|