falcon rw 1b code generation llm task2 modelC

提供商Katochh
分类code-generation
许可证apache-2.0
下载量4
星标0

简介

Falcon RW 1B 是一款轻量级的代码生成模型,专注于在极低资源占用下提供高效的编程辅助。对于中国开发者而言,这款模型最大的价值在于其极小的参数规模,非常适合部署在个人笔记本或边缘设备上,作为 IDE 插件的本地后端,实现低延迟的代码补全。它不需要昂贵的 GPU 集群即可流畅运行,上手难度极低。虽然在复杂逻辑推理上不如 GPT-4 等巨量模型,但在处理常规语法补全和函数片段生成时表现稳健,是构建私有化代码助手或轻量级自动化脚本工具的理想选择。

核心亮点

  • 参数量极小,支持低功耗设备本地化部署
  • 专注于代码生成,响应速度快,延迟极低
  • 采用 Apache-2.0 协议,商业化使用门槛低
  • 适合作为 IDE 本地补全插件的轻量化底座

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("Katochh/falcon-rw-1b-code-generation-llm-task2-modelC")
tokenizer = AutoTokenizer.from_pretrained("Katochh/falcon-rw-1b-code-generation-llm-task2-modelC")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download Katochh/falcon-rw-1b-code-generation-llm-task2-modelC

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download Katochh/falcon-rw-1b-code-generation-llm-task2-modelC config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('Katochh/falcon-rw-1b-code-generation-llm-task2-modelC')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/Katochh/falcon-rw-1b-code-generation-llm-task2-modelC

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Katochh/falcon-rw-1b-code-generation-llm-task2-modelC

模型文件托管在 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('Katochh/falcon-rw-1b-code-generation-llm-task2-modelC')
tokenizer = AutoTokenizer.from_pretrained('Katochh/falcon-rw-1b-code-generation-llm-task2-modelC')

完整文档

来源: HuggingFace

---
license: apache-2.0
library_name: peft
tags:

  • trl

  • sft

  • generated_from_trainer

base_model: petals-team/falcon-rw-1b
model-index:
  • name: falcon-rw-1b-code-generation-llm-task2-modelC

results: []
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

falcon-rw-1b-code-generation-llm-task2-modelC

This model is a fine-tuned version of petals-team/falcon-rw-1b on an unknown dataset.
It achieves the following results on the evaluation set:

  • Loss: 1.6594

Model description

More information needed

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 1e-05

  • train_batch_size: 2

  • eval_batch_size: 8

  • seed: 42

  • gradient_accumulation_steps: 2

  • total_train_batch_size: 4

  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08

  • lr_scheduler_type: cosine

  • lr_scheduler_warmup_ratio: 0.03

  • training_steps: 600

Training results

| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:------:|:----:|:---------------:|
| 1.626 | 0.0356 | 20 | 1.7087 |
| 1.9368 | 0.0712 | 40 | 1.6675 |
| 1.4542 | 0.1068 | 60 | 1.6467 |
| 1.2704 | 0.1423 | 80 | 1.6474 |
| 1.1888 | 0.1779 | 100 | 1.6618 |
| 0.9006 | 0.2135 | 120 | 1.6415 |
| 1.1376 | 0.2491 | 140 | 1.6583 |
| 0.9937 | 0.2847 | 160 | 1.6454 |
| 0.8624 | 0.3203 | 180 | 1.6594 |

Framework versions

  • PEFT 0.10.0
  • Transformers 4.40.0
  • Pytorch 2.2.1+cu121
  • Datasets 2.19.0
  • Tokenizers 0.19.1