XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Added Meta llama-3 support! (#1856)

* Added Meta llama-3 support! Decided to change llama2.py to llama.py to hold all the llama family models. * updated HuggingChat provider * Update FlowGpt.py

5fd118f3
PD <56485898+pratham-darooka@users.noreply.github.com>
提交于

代码差异

8 个文件 +54 -32
Modified README.md +24 -22
@@ -345,29 +345,31 @@ While we wait for gpt-5, here is a list of new models that are at least better t
345 345
346 346 ### Models
347 347
348 | Model | Base Provider | Provider | Website |
349 | ----- | ------------- | -------- | ------- |
350 | gpt-3.5-turbo | OpenAI | 5+ Providers | [openai.com](https://openai.com/) |
351 | gpt-4 | OpenAI | 2+ Providers | [openai.com](https://openai.com/) |
352 | gpt-4-turbo | OpenAI | g4f.Provider.Bing | [openai.com](https://openai.com/) |
353 | Llama-2-7b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
354 | Llama-2-13b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
355 | Llama-2-70b-chat-hf | Meta | 3+ Providers | [llama.meta.com](https://llama.meta.com/) |
356 | CodeLlama-34b-Instruct-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
357 | CodeLlama-70b-Instruct-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
358 | Mixtral-8x7B-Instruct-v0.1 | Huggingface | 4+ Providers | [huggingface.co](https://huggingface.co/) |
359 | Mistral-7B-Instruct-v0.1 | Huggingface | 4+ Providers | [huggingface.co](https://huggingface.co/) |
360 | dolphin-2.6-mixtral-8x7b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
361 | lzlv_70b_fp16_hf | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
362 | airoboros-70b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
348 | Model | Base Provider | Provider | Website |
349 |-----------------------------| ------------- | -------- | ------- |
350 | gpt-3.5-turbo | OpenAI | 5+ Providers | [openai.com](https://openai.com/) |
351 | gpt-4 | OpenAI | 2+ Providers | [openai.com](https://openai.com/) |
352 | gpt-4-turbo | OpenAI | g4f.Provider.Bing | [openai.com](https://openai.com/) |
353 | Llama-2-7b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
354 | Llama-2-13b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
355 | Llama-2-70b-chat-hf | Meta | 3+ Providers | [llama.meta.com](https://llama.meta.com/) |
356 | Meta-Llama-3-8b | Meta | 3+ Providers | [llama.meta.com](https://llama.meta.com/) |
357 | Meta-Llama-3-70b | Meta | 3+ Providers | [llama.meta.com](https://llama.meta.com/) |
358 | CodeLlama-34b-Instruct-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
359 | CodeLlama-70b-Instruct-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
360 | Mixtral-8x7B-Instruct-v0.1 | Huggingface | 4+ Providers | [huggingface.co](https://huggingface.co/) |
361 | Mistral-7B-Instruct-v0.1 | Huggingface | 4+ Providers | [huggingface.co](https://huggingface.co/) |
362 | dolphin-2.6-mixtral-8x7b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
363 | lzlv_70b_fp16_hf | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
364 | airoboros-70b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
363 365 | airoboros-l2-70b-gpt4-1.4.1 | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
364 | openchat_3.5 | Huggingface | 2+ Providers | [huggingface.co](https://huggingface.co/) |
365 | gemini | Google | g4f.Provider.Gemini | [gemini.google.com](https://gemini.google.com/) |
366 | gemini-pro | Google | 2+ Providers | [gemini.google.com](https://gemini.google.com/) |
367 | claude-v2 | Anthropic | 1+ Providers | [anthropic.com](https://www.anthropic.com/) |
368 | claude-3-opus | Anthropic | g4f.Provider.You | [anthropic.com](https://www.anthropic.com/) |
369 | claude-3-sonnet | Anthropic | g4f.Provider.You | [anthropic.com](https://www.anthropic.com/) |
370 | pi | Inflection | g4f.Provider.Pi | [inflection.ai](https://inflection.ai/) |
366 | openchat_3.5 | Huggingface | 2+ Providers | [huggingface.co](https://huggingface.co/) |
367 | gemini | Google | g4f.Provider.Gemini | [gemini.google.com](https://gemini.google.com/) |
368 | gemini-pro | Google | 2+ Providers | [gemini.google.com](https://gemini.google.com/) |
369 | claude-v2 | Anthropic | 1+ Providers | [anthropic.com](https://www.anthropic.com/) |
370 | claude-3-opus | Anthropic | g4f.Provider.You | [anthropic.com](https://www.anthropic.com/) |
371 | claude-3-sonnet | Anthropic | g4f.Provider.You | [anthropic.com](https://www.anthropic.com/) |
372 | pi | Inflection | g4f.Provider.Pi | [inflection.ai](https://inflection.ai/) |
371 373
372 374 ## 🔗 Powered by gpt4free
373 375
Modified g4f/Provider/FlowGpt.py +1 -1
@@ -99,4 +99,4 @@ class FlowGpt(AsyncGeneratorProvider, ProviderModelMixin):
99 99 if "event" not in message:
100 100 continue
101 101 if message["event"] == "text":
102 yield message["data"]
102 yield message["data"]
Modified g4f/Provider/HuggingChat.py +2 -1
@@ -19,7 +19,8 @@ class HuggingChat(AsyncGeneratorProvider, ProviderModelMixin):
19 19 'mistralai/Mixtral-8x7B-Instruct-v0.1',
20 20 'google/gemma-1.1-7b-it',
21 21 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO',
22 'mistralai/Mistral-7B-Instruct-v0.2'
22 'mistralai/Mistral-7B-Instruct-v0.2',
23 'meta-llama/Meta-Llama-3-70B-Instruct'
23 24 ]
24 25 model_aliases = {
25 26 "openchat/openchat_3.5": "openchat/openchat-3.5-0106",
Renamed g4f/Provider/Llama.py +6 -2
@@ -7,17 +7,21 @@ from ..requests.raise_for_status import raise_for_status
7 7 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
8 8
9 9
10 class Llama2(AsyncGeneratorProvider, ProviderModelMixin):
10 class Llama(AsyncGeneratorProvider, ProviderModelMixin):
11 11 url = "https://www.llama2.ai"
12 12 working = True
13 13 supports_message_history = True
14 default_model = "meta/llama-2-70b-chat"
14 default_model = "meta/llama-3-70b-chat"
15 15 models = [
16 16 "meta/llama-2-7b-chat",
17 17 "meta/llama-2-13b-chat",
18 18 "meta/llama-2-70b-chat",
19 "meta/llama-3-8b-chat",
20 "meta/llama-3-70b-chat",
19 21 ]
20 22 model_aliases = {
23 "meta-llama/Meta-Llama-3-8b": "meta/llama-3-8b-chat",
24 "meta-llama/Meta-Llama-3-70b": "meta/llama-3-70b-chat",
21 25 "meta-llama/Llama-2-7b-chat-hf": "meta/llama-2-7b-chat",
22 26 "meta-llama/Llama-2-13b-chat-hf": "meta/llama-2-13b-chat",
23 27 "meta-llama/Llama-2-70b-chat-hf": "meta/llama-2-70b-chat",
Modified g4f/Provider/__init__.py +1 -1
@@ -40,7 +40,7 @@ from .HuggingChat import HuggingChat
40 40 from .HuggingFace import HuggingFace
41 41 from .Koala import Koala
42 42 from .Liaobots import Liaobots
43 from .Llama2 import Llama2
43 from .Llama import Llama
44 44 from .Local import Local
45 45 from .PerplexityLabs import PerplexityLabs
46 46 from .Pi import Pi
Modified g4f/gui/client/index.html +1 -0
@@ -220,6 +220,7 @@
220 220 <option value="gpt-4">gpt-4</option>
221 221 <option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
222 222 <option value="llama2-70b">llama2-70b</option>
223 <option value="llama3-70b">llama2-70b</option>
223 224 <option value="gemini-pro">gemini-pro</option>
224 225 <option value="">----</option>
225 226 </select>
Modified g4f/gui/client/static/js/chat.v1.js +1 -1
@@ -926,7 +926,7 @@ colorThemes.forEach((themeOption) => {
926 926 function count_tokens(model, text) {
927 927 if (model) {
928 928 if (window.llamaTokenizer)
929 if (model.startsWith("llama2") || model.startsWith("codellama")) {
929 if (model.startsWith("llama") || model.startsWith("codellama")) {
930 930 return llamaTokenizer.encode(text).length;
931 931 }
932 932 if (window.mistralTokenizer)
Modified g4f/models.py +18 -4
@@ -16,7 +16,7 @@ from .Provider import (
16 16 GigaChat,
17 17 Liaobots,
18 18 FreeGpt,
19 Llama2,
19 Llama,
20 20 Vercel,
21 21 Gemini,
22 22 Koala,
@@ -117,19 +117,31 @@ gigachat_pro = Model(
117 117 llama2_7b = Model(
118 118 name = "meta-llama/Llama-2-7b-chat-hf",
119 119 base_provider = 'meta',
120 best_provider = RetryProvider([Llama2, DeepInfra])
120 best_provider = RetryProvider([Llama, DeepInfra])
121 121 )
122 122
123 123 llama2_13b = Model(
124 124 name = "meta-llama/Llama-2-13b-chat-hf",
125 125 base_provider = 'meta',
126 best_provider = RetryProvider([Llama2, DeepInfra])
126 best_provider = RetryProvider([Llama, DeepInfra])
127 127 )
128 128
129 129 llama2_70b = Model(
130 130 name = "meta-llama/Llama-2-70b-chat-hf",
131 131 base_provider = "meta",
132 best_provider = RetryProvider([Llama2, DeepInfra, HuggingChat])
132 best_provider = RetryProvider([Llama, DeepInfra, HuggingChat])
133 )
134
135 llama3_8b = Model(
136 name = "meta-llama/Meta-Llama-3-8b",
137 base_provider = "meta",
138 best_provider = RetryProvider([Llama])
139 )
140
141 llama3_70b = Model(
142 name = "meta-llama/Meta-Llama-3-70b",
143 base_provider = "meta",
144 best_provider = RetryProvider([Llama, HuggingChat])
133 145 )
134 146
135 147 codellama_34b_instruct = Model(
@@ -306,6 +318,8 @@ class ModelUtils:
306 318 'llama2-7b' : llama2_7b,
307 319 'llama2-13b': llama2_13b,
308 320 'llama2-70b': llama2_70b,
321 'llama3-8b' : llama3_8b,
322 'llama3-70b': llama3_70b,
309 323 'codellama-34b-instruct': codellama_34b_instruct,
310 324 'codellama-70b-instruct': codellama_70b_instruct,
311 325