Downloads · 30 days
0
math-zhu/CogniLite
CogniLite is a text generation model from math-zhu. Use it when you need the model to write or continue text. It is set up for fasttext. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated May 26, 2025
Parameters
109M
218 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors218 MB · 100%
From the Hugging Face model README
只需要700MB就可以运行的模型
打开B主页,点进去一个视频;如果这个时候你的电脑没有爆炸,就可以运行。
使用了MiniMind2的模型参数:
安装依赖:
pip install torch, transformer
运行模型:
python model_congnilite.py
在流式输出中,每输出一个token_id,就将它解码为字符并输出,会造成中文乱码现象,但是将token_id放到一个列表中一起解码就不会出现乱码
专业描述:token边界不对齐导致的解码错误
原本的代码:
new_token_str = tokenizer.decode(next_token_id.item(), skip_special_tokens=False)
print(new_token_str, end='', flush=True)
更改后:
prev_decoded = tokenizer.decode(token_list[:-1], skip_special_tokens=False)
curr_decoded = tokenizer.decode(token_list, skip_special_tokens=False)
print(curr_decoded[len(prev_decoded):], end='', flush=True)