YAML Metadata
Warning:
The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
只需要700MB就可以运行的模型
如何判断电脑是否可以运行
打开B主页,点进去一个视频;如果这个时候你的电脑没有爆炸,就可以运行。
介绍
使用了MiniMind2的模型参数:
- Github项目链接在:Github Link
- HuggingFace链接在 Hugging Face
快速开始
安装依赖:
pip install torch, transformer
运行模型:
python model_congnilite.py
常见问题介绍
在流式输出中,每输出一个token_id,就将它解码为字符并输出,会造成中文乱码现象,但是将token_id放到一个列表中一起解码就不会出现乱码
专业描述:token边界不对齐导致的解码错误
- tokenizer采用的是子词(subword)分词(如BPE、SentencePiece等),一个汉字或词语可能被拆成多个token。
- 单独解码一个token_id时,tokenizer.decode()会把这个token当作一个完整的单元去还原为字符,但实际上它可能只是一个汉字的“片段”或“字节”,导致输出乱码或不可见字符。
- 只有把一组token_id(即一个完整的token序列)一起decode,tokenizer才能正确地拼接还原出原始的中文字符。
原本的代码:
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)
- Downloads last month
- -
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support