Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicate Version Numbers and issues with running Llama 3 using Langchain's Replicate class #20757

Open
5 tasks done
abhirupghosh opened this issue Apr 22, 2024 · 3 comments · May be fixed by langchain-ai/langchainjs#5221
Open
5 tasks done
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@abhirupghosh
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from langchain_community.llms import Replicate

model = Replicate(
    model="meta/meta-llama-3-70b-instruct:" + version,
    model_kwargs={"temperature": 0.2, "max_length": 1024, "top_p": 1},
)

This when compared to directly using Replicate's API within Python:

import replicate

replicate.run(
        "meta/meta-llama-3-70b-instruct",
        input={
            "top_p": 0.9,
            "prompt": prompt,
            "max_tokens": 512,
            "min_tokens": 0,
            "temperature": 0.6,
            "prompt_template": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are a helpful assistant<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
            "presence_penalty": 1.15,
            "frequency_penalty": 0.2
        }
    )

Error Message and Stack Trace (if applicable)

replicate.exceptions.ReplicateError: ReplicateError Details:
title: Invalid version or not permitted
status: 422
detail: The specified version does not exist (or perhaps you don't have permission to use it?)

Description

I am trying to use Langchain to use Llama 3 - however, there are no version numbers that are required when I am using Replicate's API directly. There are also no direct ways on the Replicate website to find which specific version number we are using when trying to use replicate.

To identify the version number, I queried https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct as a GET request, and received the latest_version in the response. Upon feeding this latest_version into the 'version' variable, I still get the above error message.

Two questions:

  1. Am I doing something wrong here when invoking the Replicate model using Langchain?
  2. Can we get rid of the version number requirement, when Replicate's own API does not require a version number in most scenarios? It could be an optional parameter perhaps.

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030
Python Version: 3.9.18 | packaged by conda-forge | (main, Dec 23 2023, 16:35:41)
[Clang 16.0.6 ]

Package Information

langchain_core: 0.1.42
langchain: 0.1.16
langchain_community: 0.0.32
langsmith: 0.1.46
langchain_text_splitters: 0.0.1

Packages not installed (Not Necessarily a Problem)

The following packages were not found:

langgraph
langserve

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Apr 22, 2024
@ebakken
Copy link

ebakken commented Apr 25, 2024

This is also an issue with langchainjs.

Setting the Replicate model version was made optional some time ago, but the Langchain wrappers has not been updated to reflect this change. Public Replicate models should now be run without setting version.

@smontgomerie smontgomerie linked a pull request Apr 26, 2024 that will close this issue
@abhirupghosh
Copy link
Author

Any update on correcting this? A lot of newer models (such as Llama 3) do not explicitly mention the version numbers on Replicate's end. To reiterate, to identify the version number, I queried https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct as a GET request, and received the latest_version in the response. Upon feeding this latest_version into the 'version' variable, I still get the same error message.

I am temporarily being forced to use Replicate's API directly, which makes it more difficult to utilize inbuilt output parsers, amongst various other thing.

@adiropit
Copy link

adiropit commented May 6, 2024

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants