nsarrazin HF staff commited on
Commit
8582ce1
1 Parent(s): 9c8ed38

Add support for Meta Llama 3 70B in HuggingChat (#1029)

Browse files
.env.template CHANGED
@@ -27,6 +27,31 @@ MODELS=`[
27
  }
28
  ]
29
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  {
31
  "name" : "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
32
  "tokenizer": "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
@@ -51,7 +76,7 @@ MODELS=`[
51
  "prompt": "How do I make a delicious lemon cheesecake?"
52
  }
53
  ]
54
- },
55
  {
56
  "name" : "mistralai/Mixtral-8x7B-Instruct-v0.1",
57
  "description" : "The latest MoE model from Mistral AI! 8x7B and outperforms Llama 2 70B in most benchmarks.",
 
27
  }
28
  ]
29
  },
30
+ {
31
+ "name" : "meta-llama/Meta-Llama-3-70B-Instruct",
32
+ "description": "Generation over generation, Meta Llama 3 demonstrates state-of-the-art performance on a wide range of industry benchmarks and offers new capabilities, including improved reasoning.",
33
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
34
+ "modelUrl": "https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct",
35
+ "websiteUrl": "https://llama.meta.com/llama3/",
36
+ "tokenizer" : "meta-llama/Meta-Llama-3-70B-Instruct",
37
+ "promptExamples" : [
38
+ {
39
+ "title": "Write an email from bullet list",
40
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
41
+ }, {
42
+ "title": "Code a snake game",
43
+ "prompt": "Code a basic snake game in python, give explanations for each step."
44
+ }, {
45
+ "title": "Assist in a task",
46
+ "prompt": "How do I make a delicious lemon cheesecake?"
47
+ }
48
+ ],
49
+ "parameters": {
50
+ "stop": ["<|eot_id|>"],
51
+ "truncate": 6144,
52
+ "max_new_tokens": 2047
53
+ }
54
+ },
55
  {
56
  "name" : "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
57
  "tokenizer": "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
 
76
  "prompt": "How do I make a delicious lemon cheesecake?"
77
  }
78
  ]
79
+ },
80
  {
81
  "name" : "mistralai/Mixtral-8x7B-Instruct-v0.1",
82
  "description" : "The latest MoE model from Mistral AI! 8x7B and outperforms Llama 2 70B in most benchmarks.",
src/lib/components/ModelCardMetadata.svelte CHANGED
@@ -1,6 +1,7 @@
1
  <script lang="ts">
2
  import CarbonEarth from "~icons/carbon/earth";
3
  import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
 
4
  import type { Model } from "$lib/types/Model";
5
 
6
  export let model: Pick<Model, "name" | "datasetName" | "websiteUrl" | "modelUrl" | "datasetUrl">;
@@ -41,8 +42,13 @@
41
  class="ml-auto flex items-center hover:underline"
42
  rel="noreferrer"
43
  >
44
- <CarbonEarth class="mr-1.5 shrink-0 text-xs text-gray-400" />
45
- Website
 
 
 
 
 
46
  </a>
47
  {/if}
48
  </div>
 
1
  <script lang="ts">
2
  import CarbonEarth from "~icons/carbon/earth";
3
  import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
4
+ import BIMeta from "~icons/bi/meta";
5
  import type { Model } from "$lib/types/Model";
6
 
7
  export let model: Pick<Model, "name" | "datasetName" | "websiteUrl" | "modelUrl" | "datasetUrl">;
 
42
  class="ml-auto flex items-center hover:underline"
43
  rel="noreferrer"
44
  >
45
+ {#if model.name === "meta-llama/Meta-Llama-3-70B-Instruct"}
46
+ <BIMeta class="mr-1.5 shrink-0 text-xs text-gray-400" />
47
+ Built with Meta Llama 3
48
+ {:else}
49
+ <CarbonEarth class="mr-1.5 shrink-0 text-xs text-gray-400" />
50
+ Website
51
+ {/if}
52
  </a>
53
  {/if}
54
  </div>
src/routes/conversation/[id]/+server.ts CHANGED
@@ -447,7 +447,8 @@ export async function POST({ request, locals, params, getClientAddress }) {
447
  messageToWriteTo.content += output.token.text;
448
  }
449
  } else {
450
- messageToWriteTo.interrupted = !output.token.special;
 
451
  // add output.generated text to the last message
452
  // strip end tokens from the output.generated_text
453
  const text = (model.parameters.stop ?? []).reduce((acc: string, curr: string) => {
 
447
  messageToWriteTo.content += output.token.text;
448
  }
449
  } else {
450
+ messageToWriteTo.interrupted =
451
+ !output.token.special && !model.parameters.stop?.includes(output.token.text);
452
  // add output.generated text to the last message
453
  // strip end tokens from the output.generated_text
454
  const text = (model.parameters.stop ?? []).reduce((acc: string, curr: string) => {