Giter VIP home page Giter VIP logo

llama-chat's Introduction

Llama Chat ๐Ÿฆ™

This is a Next.js app that demonstrates how to build a chat UI using the Llama 3 language model and Replicate's streaming API (private beta).

Here's a demo:

llama3-hq.mp4

Usage

Install dependencies:

npm install

Add your Replicate API token to .env.local:

REPLICATE_API_TOKEN=<your-token-here>

Run the development server:

npm run dev

Open http://localhost:3000 with your browser.

For detailed instructions on how to create and use this template, see replicate.com/docs/get-started/nextjs

llama-chat's People

Contributors

bfirsh avatar cbh123 avatar chigozienri avatar dependabot[bot] avatar fofr avatar hairboat avatar mattt avatar maxleiter avatar mcantillon21 avatar technillogue avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

llama-chat's Issues

error while getting response

Hey!

I am getting an error while getting data from llama-3-8b* and llama-3-70b*.

Screenshot (264)

above you can see the screenshot of the error.

Thanks!

Llava and Salmonn do not properly recognise second file.

A second file can be uploaded, but Llava and Salmonn keep referring to the previously uploaded file. I believe this is because they get sent the messageHistory, and this is prioritised over the file.

To replicate:

  1. Upload an image or audio file.
  2. Ask "What's in this [image/audio file]?" and receive description of file 1.
  3. Upload a second image or audio file.
  4. Ask "What's in this [image/audio file]?" and receive description of file 1 again (or even "In the audio file, there is a person speaking about the [contents of image 1]" if you switched between an image and an audio file).

A simple fix would be to (warn the user and) remove all previous message history when a new file is uploaded.

Error while generating codes

image

{"**", "<b>"}, 
{"*", "<i>"}, 
{"_", "<u>"}, 
{"`", "<code>"}, 
{"##", "<h2>"}, 
"#", "<h1>",
 "[", "<a href=\"{0}\">"], 
"]", "</a>"}, 
{"\n", "<br>"}, 
{" ", "<span style=\"font-size: larger\">"}

[Bug] Function invocation error when deployed to Vercel

Sample chat code works fine locally; getting this error when deployed to Vercel:

llama-98079bc32b437141.js:1 Uncaught (in promise) Error: Server error: A server error has occurred

FUNCTION_INVOCATION_FAILED

at llama-98079bc32b437141.js:1:7882
at l (main-1a90909837c5cc42.js:1:2020)
at Generator._invoke (main-1a90909837c5cc42.js:1:1808)
at P.forEach.e.<computed> [as next] (main-1a90909837c5cc42.js:1:2443)
at v (llama-98079bc32b437141.js:1:4641)
at o (llama-98079bc32b437141.js:1:4844)

Issue

Unhandled Runtime Error
Error: Objects are not valid as a React child (found: [object Error]). If you meant to render a collection of children, use an array instead.

Call Stack
throwOnInvalidObjectType
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (8872:0)
reconcileChildFibersImpl
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (9879:0)
reconcileChildFibers
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (9900:0)
reconcileChildren
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (15606:0)
updateHostComponent$1
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (16568:0)
beginWork$1
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (18390:0)
beginWork
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (26741:0)
performUnitOfWork
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (25587:0)
workLoopSync
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (25303:0)
renderRootSync
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (25258:0)
performSyncWorkOnRoot
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (24727:0)
flushSyncWorkAcrossRoots_impl
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (10274:0)
flushSyncWorkOnAllRoots
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (10234:0)
processRootScheduleInMicrotask
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (10379:0)
eval
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (10550:0)

Llava model image upload fail

When selecting Llava from drop down. Any filetype attempted in image upload fails. Error: does not accept file type jpeg, png etc. Latest version fetched today.

Question: Why are special tokens added to the prompt being sent to replicate?

In Replicate, the Llama-3-8b-instruct model takes in a "system_prompt" and "prompt_template" param. The replicate docs mentioned that system_prompt is prepended to the text being sent, and I'm assuming the prompt_template is also used to format the prompt data since there's a default value that includes the special tokens. Is there a reason this application is formatting the prompt to also use these special tokens? I guess I'm just a little confused how this is being handled by Replicate behind the scenes.

For example, for the message "Can you tell me about the story of David and Goliath" the front-end sends:

{
  system_prompt: "You are a helpful assistant.",
  prompt: "<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a helpful assistant.<|eot_id|>
<|start_header_id|>user<|end_header_id|>

Can you tell me about the story of David and Goliath<|eot_id|>"
}

The default "prompt_template" seems to be:

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

{system_prompt}<|eot_id|><|start_header_id|>user<|end_header_id|>

{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>

So, behind the scenes, it seems like what gets passed to the model becomes:

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>

<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a helpful assistant.<|eot_id|>
<|start_header_id|>user<|end_header_id|>

Can you tell me about the story of David and Goliath<|eot_id|><|eot_id|><|start_header_id|>assistant<|end_header_id|>

since the prompt and system_prompt are possibly directly passed into the prompt template. Is this a correct understanding?

IMAGE Upload Not Working

After uploading the image and giving a prompt to it . The Model stops working and throws an application error

Client Side Error

Screenshot (9)

On opening https://llama.replicate.dev/ when i start a chat with ai press enter a window pops up which shows Application error: a client-side exception has occurred (see the browser console for more information).

Copied text looses all linebreaks

Since the text containing div uses flex the text is displayed like it had a linebreak after each span. It looks properly, however, once text is copied it has no linebreaks (as the text in the HTML has none)

This makes copying generated texts, lists, code difficult, as all visible text lines are merged into one mess without linebreaks.

CUDA error: an illegal memory access was encountered

Seeing this error in the console:

{
  "detail": "CUDA error: an illegal memory access was encountered\\nCUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.\\nFor debugging consider passing CUDA_LAUNCH_BLOCKING=1.\\nCompile with `TORCH_USE_CUDA_DSA` to enable device-side assertions."
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.