[C#]基于C# winform结合llamasharp部署llama3中文的gguf模型

news/2024/10/11 0:20:11/

【llmasharp源码】

https://github.com/SciSharp/LLamaSharp

【测试模型】

https://www.modelscope.cn/pooka74/LLaMA3-8B-Chat-Chinese-GGUF.git

【测试通过环境】

vs2019

netframework4.7.2

llamasharp==0.15.0

cuda11.7.1+cudnn8.8.0

注意测试发现使用cpu推理非常卡,因此建议配置有个nvidia显卡电脑进行测试,要求显存>=6GB,我电脑是RTX2070 8GB显存

【界面演示】

 

【部分实现源码】

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FIRC;namespace WindowsFormsApp1
{public partial class Form1 : Form{LLamaInfer infer = null;public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){//模型在https://www.modelscope.cn/pooka74/LLaMA3-8B-Chat-Chinese-GGUF.git下载infer= new LLamaInfer(@"H:\llama3-8b-chat-chinese-gguf\LLaMA3-8B-Chat-Chinese-Q4_K_M.gguf");infer.CallBack += Infer_CallBack;}private void Infer_CallBack(string msg){tb_output.AppendText(msg);}private void btn_input_Click(object sender, EventArgs e){if(string.IsNullOrEmpty(tb_input.Text)){return;}infer.GetResult(tb_input.Text);}private void button1_Click(object sender, EventArgs e){tb_output.Clear();}}
}

【源码下载地址】


http://www.ppmy.cn/news/1506789.html

相关文章

el-input输入数字,带有千分位

封装组件 <template><el-inputchange"changenum"blur"blurInput"v-model"inputnum1"placeholder"请输入数字"clearable:disabled"disablednum":class" inputcolor ? input_num_dis : "></el-in…

[MRCTF2020]Ezpop

[MRCTF2020]Ezpop 题目是pop&#xff0c;考的其实就是pop链&#xff0c;可以自己先学学&#xff0c;啥也不会QAQ php反序列化之pop链_pop3.phpwelcome-CSDN博客 POP 面向属性编程(Property-Oriented Programing) 常用于上层语言构造特定调用链的方法&#xff0c;与二进制利用…

【JVM基础14】——垃圾回收-强引用、软引用、弱引用、虚引用的区别

目录 1- 引言&#xff1a;为什么分多种引用类型2- ⭐核心&#xff1a;2-1 强引用2-2 软引用2-3 弱引用2-4 虚引用 3- 小结&#xff1a;3-1 强引用、软引用、弱引用、虚引用的区别&#xff1f; 1- 引言&#xff1a;为什么分多种引用类型 在 Java 中&#xff0c;引用类型被分为强…

240810-Gradio通过HTML组件打开本地文件+防止网页跳转到about:blank

A. 最终效果 B. 可通过鼠标点击打开文件&#xff0c;但会跳转到about:blank import gradio as gr import subprocessdef open_pptx():pptx_path /Users/liuguokai/Downloads/240528-工业大模型1.pptxtry:subprocess.Popen([open, pptx_path])return "PPTX file opened s…

LVS(Linux virual server)详解

目录 一、LVS&#xff08;Linux virual server&#xff09;是什么&#xff1f; 二、集群和分布式简介 2.1、集群Cluster 2.2、分布式 2.3、集群和分布式 三、LVS运行原理 3.1、LVS基本概念 3.2、LVS集群的类型 3.2.1 nat模式 3.2.2 DR模式 3.2.3、LVS工作模式总结 …

Vue引入使用iconfont字体图标

由于element-ui或element-plus提供的图标有时候并不能满足日常需求,所以这篇介绍一下前端引入阿里巴巴矢量图标库使用,不止是vue使用,不限于vue2、vue3,html或是其他框架也是同样的道理,只要引入都是同样可以使用的。 1. 首先进入阿里巴巴矢量图标库官网 官网:https://…

源码编译安装LAMP(HTTP服务,MYSQL ,PHP,以及bbs论坛)

前言&#xff1a;资源 下载在https://download.csdn.net/download/YCyjs/89618650下载&#xff0c;可在生产环境使。 一、安装Apache 下面两个插件是httpd2.4以后的版本所需要 tar xf apr-1.6.2.tar.gz tar xf apr-util-1.6.0.tar.gz 虽然xf通常足够&#xff0c;但使用与压缩…

Android .kl按键布局文件

1.介绍 一个硬件按键的处理流程大致为&#xff1a;当用户按下或释放一个键时&#xff0c;键盘硬件会生成一个扫描码scan code&#xff0c;然后操作系统读取这个scan code&#xff0c;并将scan code扫描码映射到虚拟键码key code&#xff0c;最后操作系统根据映射的keycode生成…