falcon rw 1b code generation llm task2

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

简介

Falcon RW 1B 是一款轻量级的代码生成模型,主打高效能与低资源占用。对于国内开发者而言,它最大的优势在于极小的参数量,这意味着你无需昂贵的 A100 集群,在普通的消费级显卡甚至部分高性能笔记本上即可流畅运行。该模型专注于代码补全和生成任务,适合集成到轻量级 IDE 插件或作为端侧辅助编程工具。虽然它不能替代 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")
tokenizer = AutoTokenizer.from_pretrained("Katochh/falcon-rw-1b-code-generation-llm-task2")

Hugging Face 下载

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

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

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

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

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

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

Git 下载

请确保 lfs 已经被正确安装

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

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

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

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

完整文档

来源: 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

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

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.0581

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: 0.0001

  • 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: 320

Training results

| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-----:|:----:|:---------------:|
| 1.3318 | 0.1 | 20 | 1.3407 |
| 1.2643 | 0.2 | 40 | 1.1844 |
| 1.1681 | 0.3 | 60 | 1.1522 |
| 1.0891 | 0.4 | 80 | 1.1209 |
| 1.2164 | 0.5 | 100 | 1.1265 |
| 1.0855 | 0.6 | 120 | 1.1010 |
| 1.1129 | 0.7 | 140 | 1.0897 |
| 1.1169 | 0.8 | 160 | 1.0799 |
| 1.0664 | 0.9 | 180 | 1.0706 |
| 1.1483 | 1.0 | 200 | 1.0756 |
| 0.9707 | 1.1 | 220 | 1.0625 |
| 1.0102 | 1.2 | 240 | 1.0624 |
| 1.0805 | 1.3 | 260 | 1.0615 |
| 0.969 | 1.4 | 280 | 1.0580 |
| 1.118 | 1.5 | 300 | 1.0582 |
| 0.9883 | 1.6 | 320 | 1.0581 |

Framework versions

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