@lzhzzzzwill/cofos 1.0.0 → 1.0.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # COFOS CLI
2
2
 
3
- 一个本地 LLM 聊天 CLI:3D 立体欢迎界面 + Hugging Face 模型对话。
3
+ 一个本地 COFOS 模型聊天 CLI:3D 立体欢迎界面 + Hugging Face 模型对话。
4
4
 
5
5
  ```bash
6
6
  npx cofos
@@ -34,7 +34,24 @@ git clone <repo> && cd demo && npm link
34
34
  cofos
35
35
  ```
36
36
 
37
- 首次运行会自动安装 Python 依赖并下载模型(约 30-60 秒)。
37
+ 首次运行会自动安装 Python 依赖,并从 Hugging Face 下载或读取缓存中的 `Willlzh/COFOS` 模型。9B 模型首次加载会明显慢于小模型,请耐心等待进度提示。
38
+
39
+
40
+ ## 默认模型
41
+
42
+ `fwdemo` 默认加载 Hugging Face 模型:
43
+
44
+ ```text
45
+ Willlzh/COFOS
46
+ ```
47
+
48
+ 可以在 CLI 内用 `/model <repo-or-path>` 临时切换到其它 Hugging Face 模型或本地 merged 模型目录。
49
+
50
+ 关联数据集:
51
+
52
+ ```text
53
+ Willlzh/COFOS_data
54
+ ```
38
55
 
39
56
  ## 命令
40
57
 
@@ -93,7 +110,7 @@ cofos
93
110
  |----|------|------|
94
111
  | CLI 前端 | Node.js (ESM) | 终端 UI、子进程管理、管道通信 |
95
112
  | 模型后端 | Python + transformers | 模型加载、token 生成、流式输出 |
96
- | 模型 | SmolLM2-360M-Instruct (HF) | 对话推理 |
113
+ | 模型 | Willlzh/COFOS (HF) | COFOS 专业问答推理 |
97
114
  | 通信 | stdin/stdout 管道 | 进程间消息传递 |
98
115
  | 分發 | npm | 包管理、全局命令、npx |
99
116
 
@@ -101,7 +118,7 @@ cofos
101
118
 
102
119
  - Node.js ≥ 18
103
120
  - Python 3.8+
104
- - 首次运行需联网(下载模型,~360MB)
121
+ - 首次运行需联网(下载 `Willlzh/COFOS` 模型;模型体积较大)
105
122
 
106
123
  ## 开发
107
124
 
package/bin/cofos.js CHANGED
@@ -92,7 +92,7 @@ function main() {
92
92
  if (!existsSync(chatScript)) { console.error("[cofos] Missing script:", chatScript); process.exit(1); }
93
93
  ensureDeps(py);
94
94
 
95
- console.log(" Loading model … (30–60 s on first run)\n");
95
+ console.log(" Loading COFOS model … first run may take a while\n");
96
96
 
97
97
  const proc = spawn(py, [chatScript], { stdio: ["pipe", "pipe", "inherit"], encoding: "utf-8" });
98
98
 
@@ -163,7 +163,7 @@ function main() {
163
163
  if (/^\/(clear)$/.test(input)) { render(); console.log(""); ask(); return; }
164
164
  if (/^\/(info)$/.test(input)) {
165
165
  console.log("\n COFOS CLI — v1.0.0");
166
- console.log(" Model: HuggingFaceTB/SmolLM2-360M-Instruct");
166
+ console.log(" Model: Willlzh/COFOS");
167
167
  console.log(" Backend: transformers + PyTorch\n");
168
168
  ask(); return;
169
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lzhzzzzwill/cofos",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A local LLM chat CLI with a 3D stereoscopic welcome screen.",
5
5
  "type": "module",
6
6
  "bin": {
package/scripts/chat.py CHANGED
@@ -9,21 +9,21 @@ from transformers import (
9
9
  TextIteratorStreamer,
10
10
  )
11
11
 
12
- MODEL_ID = "HuggingFaceTB/SmolLM2-360M-Instruct"
12
+ MODEL_ID = "Willlzh/COFOS"
13
13
 
14
14
 
15
15
  def main() -> None:
16
16
  model_id = sys.argv[1] if len(sys.argv) > 1 else MODEL_ID
17
17
 
18
18
  print(f"[chat] Loading {model_id} …", file=sys.stderr, flush=True)
19
- print(f"[chat] 30–60 s on first run (model download).", file=sys.stderr, flush=True)
19
+ print(f"[chat] First run may take a while while the COFOS model is downloaded or read from cache.", file=sys.stderr, flush=True)
20
20
 
21
- tokenizer = AutoTokenizer.from_pretrained(model_id)
21
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
22
22
  if tokenizer.pad_token_id is None:
23
23
  tokenizer.pad_token_id = tokenizer.eos_token_id
24
24
 
25
25
  model = AutoModelForCausalLM.from_pretrained(
26
- model_id, dtype="float32", low_cpu_mem_usage=True,
26
+ model_id, dtype="auto", device_map="auto", trust_remote_code=True, low_cpu_mem_usage=True,
27
27
  )
28
28
  model.eval()
29
29
 
@@ -38,11 +38,11 @@ def main() -> None:
38
38
  break
39
39
  if line.startswith("/model "):
40
40
  mid = line[len("/model "):].strip()
41
- tokenizer = AutoTokenizer.from_pretrained(mid)
41
+ tokenizer = AutoTokenizer.from_pretrained(mid, trust_remote_code=True)
42
42
  if tokenizer.pad_token_id is None:
43
43
  tokenizer.pad_token_id = tokenizer.eos_token_id
44
44
  model = AutoModelForCausalLM.from_pretrained(
45
- mid, dtype="float32", low_cpu_mem_usage=True,
45
+ mid, dtype="auto", device_map="auto", trust_remote_code=True, low_cpu_mem_usage=True,
46
46
  )
47
47
  model.eval()
48
48
  print("===DONE===", flush=True)