l4 08 code generation model
简介
l4-08 是一款由 llm-crafter 推出的专注代码生成的轻量化模型。它摒弃了通用大模型的冗余,将权重集中在编程语言的逻辑构建和语法优化上,旨在为开发者提供更精准的代码补全和函数实现。对于习惯使用 VS Code 或 JetBrains 的用户来说,该模型非常适合作为本地 IDE 插件的后端,在低资源占用下实现快速的实时代码建议。由于采用 Apache-2.0 开源协议,企业可以灵活地将其私有化部署,无需担心数据出海,是构建自有代码助手的高性价比选择。
核心亮点
- 专注代码生成,逻辑推演比通用模型更精准
- Apache-2.0 协议,支持企业级私有化部署
- 低资源占用,适配本地 IDE 实时补全场景
- 上手门槛低,可快速集成至现有开发工作流
使用方法
安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("llm-crafter/l4-08-code-generation-model")
tokenizer = AutoTokenizer.from_pretrained("llm-crafter/l4-08-code-generation-model")
Hugging Face 下载
我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。
操作指引:在下载前,请先通过如下命令安装 huggingface_hub:
操作指引
pip install -U huggingface_hub
命令行下载
下载完整模型库
下载完整模型库
huggingface-cli download llm-crafter/l4-08-code-generation-model
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download llm-crafter/l4-08-code-generation-model config.json --local-dir ./dir
SDK 下载
SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('llm-crafter/l4-08-code-generation-model')
Git 下载
请确保 lfs 已经被正确安装
Git 下载
git lfs install
git clone https://huggingface.co/llm-crafter/l4-08-code-generation-model
如果您希望跳过 lfs 大文件下载,可以使用如下命令
跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/llm-crafter/l4-08-code-generation-model
模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。
PyTorch / Transformers 使用
安装 Transformers
安装 Transformers
pip install -U transformers torch
模型加载和推理
模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('llm-crafter/l4-08-code-generation-model')
tokenizer = AutoTokenizer.from_pretrained('llm-crafter/l4-08-code-generation-model')
完整文档
来源: HuggingFace
---
base_model: unsloth/llama-3.2-1b-instruct-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
license: apache-2.0
language:
- en
---
Uploaded model
- Developed by: llm-crafter
- License: apache-2.0
- Finetuned from model : unsloth/llama-3.2-1b-instruct-bnb-4bit
This llama model was trained 2x faster with Unsloth