Qwen1.5是阿里云推出的一系列大型语言模型。 Qwen是阿里云推出的一系列基于Transformer的大型语言模型,在大量数据(包括网页文本、书籍、代码等)进行了预训练。
CPU配置:CPU最低第六代intel酷睿4核,AMD ZEN 4核以上;推荐12代intel酷睿8核,AMD ZEN 8核以上 内存要求:运行内存4G及以上
6个模型大小,包括0.5B、1.8B、4B(默认)、7B、14B、32B(新)和72B 人类对话模型的偏好显著改善 基础模型和对话模型都支持多语言 所有大小的模型都稳定支持32K上下文长度 原始的Qwen模型提供了四种不同的参数大小:1.8B、7B、14B和72B。
低成本的部署:推理过程的最低内存要求小于2GB。 大规模高质量的训练语料库:模型在超过22万亿个令牌的语料库上进行了预训练,包括中文、英文、多语言文本、代码和数学,涵盖了一般和专业领域。通过大量的消融实验,对预训练语料库的分布进行了优化。 良好的性能:Qwen支持较长的上下文长度(在1.8b、7b和14b参数模型上为8K,在72b参数模型上为32K),在多个中英文下游评估任务(包括常识、推理、代码、数学等)上显著超过了现有的开源模型,甚至在一些基准测试中超过了一些更大规模的模型。 更全面的词汇覆盖:与其他基于中英文词汇的开源模型相比,Qwen使用了超过15万个令牌的词汇表。这个词汇表对于多种语言更友好,使用户在不扩展词汇表的情况下,能够直接增强特定语言的能力。 系统提示:通过使用系统提示,Qwen可以实现角色扮演、语言风格转换、任务设置和行为设置等功能。
| Model | MMLU | C-Eval | GSM8K | MATH | HumanEval | MBPP | BBH | CMMLU |
|---|---|---|---|---|---|---|---|---|
| GPT-4 | 86.4 | 69.9 | 92.0 | 45.8 | 67.0 | 61.8 | 86.7 | 71.0 |
| Llama2-7B | 46.8 | 32.5 | 16.7 | 3.3 | 12.8 | 20.8 | 38.2 | 31.8 |
| Llama2-13B | 55.0 | 41.4 | 29.6 | 5.0 | 18.9 | 30.3 | 45.6 | 38.4 |
| Llama2-34B | 62.6 | - | 42.2 | 6.2 | 22.6 | 33.0 | 44.1 | - |
| Llama2-70B | 69.8 | 50.1 | 54.4 | 10.6 | 23.7 | 37.7 | 58.4 | 53.6 |
| Mistral-7B | 64.1 | 47.4 | 47.5 | 11.3 | 27.4 | 38.6 | 56.7 | 44.7 |
| Mixtral-8x7B | 70.6 | - | 74.4 | 28.4 | 40.2 | 60.7 | - | - |
| Qwen1.5-7B | 61.0 | 74.1 | 62.5 | 20.3 | 36.0 | 37.4 | 40.2 | 73.1 |
| Qwen1.5-14B | 67.6 | 78.7 | 70.1 | 29.2 | 37.8 | 44.0 | 53.7 | 77.6 |
| Qwen1.5-32B | 73.4 | 83.5 | 77.4 | 36.1 | 37.2 | 49.4 | 66.8 | 82.3 |
| Qwen1.5-72B | 77.5 | 84.1 | 79.5 | 34.1 | 41.5 | 53.4 | 65.5 | 83.5 |
Ollama 是一个便于本地部署和运行大型语言模型(Large Language Models, LLMs)的工具。使用通俗的语言来说,如果你想在自己的电脑上运行如 GPT-3 这样的大型人工智能模型,而不是通过互联网连接到它们,那么 Ollama 是一个实现这一目标的工具。下面我们来详细总结一下 Ollama 的功能和使用场景。
Open WebUI(以前称为Ollama WebUI)是一款面向大型语言模型(LLMs)的用户友好型Web界面,支持Ollama和兼容OpenAI的API运行。通过一个直观的界面,它为用户提供了一种便捷的方式,与语言模型进行交互、训练和管理。
#命令加载文档或添加文件。#命令来丰富聊天体验。/命令快速访问预设提示。version: '3' services: ollama: image: ollama/ollama container_name: ollama restart: unless-stopped ports: - 11434:11434 volumes: - ./data:/root/.ollama run
docker-compose up -d visit http://localhost:11434/ return “Ollama is running ” into the docker shell and run command
ollama pull llama2-chinese:7b run model llama2-chinese:7b
ollama run llama2-chinese:7b version: '3' services: ollama-webui: image: ghcr.io/open-webui/open-webui:main container_name: ollama-webui restart: unless-stopped ports: - 11433:8080 volumes: - ./data:/app/backend/data environment: - OLLAMA_API_BASE_URL=http://10.11.68.77:11434/api - WEBUI_SECRET_KEY=TkjGEiQ@5K^j run
docker-compose up -d http://localhost:11433/

第一次需要注册账号

用open ai包对接qwen:0.5b
org.springframework.boot spring-boot-starter-parent 3.2.1 4.0.0 Qwen 17 17 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-autoconfigure org.springframework.boot spring-boot-starter-test test org.springframework.ai spring-ai-openai-spring-boot-starter 0.8.0-SNAPSHOT spring-snapshots Spring Snapshots https://repo.spring.io/snapshot false org.apache.maven.plugins maven-compiler-plugin 3.8.1 true false org.apache.maven.plugins maven-surefire-plugin 2.22.2 0 false package com.et.qwen.controller; import org.springframework.ai.chat.ChatClient; import org.springframework.ai.chat.prompt.Prompt; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; @RestController public class HelloWorldController { @RequestMapping("/hello") public Map showHelloWorld(){ Map map = new HashMap<>(); map.put("msg", "HelloWorld"); return map; } @Autowired ChatClient chatClient; @GetMapping("/ai/chat") public String chat(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { Prompt prompt = new Prompt(message); return chatClient.call(prompt).getResult().getOutput().getContent(); } } server: port: 8088 spring: ai: openai: base-url: https://api.openai.com/ api-key: sk-xxx embedding: options: model: text-davinci-003 chat: #指定某一个API配置(覆盖全局配置) api-key: sk-xxx base-url: http://localhost:11434 options: model: qwen:0.5b # 模型配置 以上只是一些关键代码,所有代码请参见下面代码仓库
2024-07-15 15:06:28 [GIN] 2024/07/15 - 07:06:28 | 200 | 4.810762037s | 172.20.0.1 | POST "/api/chat" 2024-07-15 15:06:29 [GIN] 2024/07/15 - 07:06:29 | 200 | 1.081850365s | 172.20.0.1 | POST "/v1/chat/completions" 2024-07-15 15:06:46 [GIN] 2024/07/15 - 07:06:46 | 200 | 46.802µs | 172.20.0.1 | GET "/api/version"