Hey I am facing issues
pls helpScreenshot 2024-09-23 2300481473×480 38.5 KB
2024-09-23T17:47:53Z
Here is the starting of the codeScreenshot 2024-09-23 2300091489×567 35.4 KB
2024-09-23T17:48:25Z
And the code after itScreenshot 2024-09-23 2300271449×414 21 KB
2024-09-23T19:17:30Z
Update tried using try except block  to know about the error .Screenshot 2024-09-24 0046141624×554 29.2 KB
2024-09-24T02:02:20Z
I just had a quick look andyour HF token is in your uploaded imagebefore I take care of the problem.Pleasego remove the token leakedfirst. Once erased, the token is no longer needed, so it doesn’t matter if it has leaked.Also, it would be easier for me to respond if you could write in the text.You can quote the code in a nice way by enclosing it in ```. like this,import osMarkdown Land – 11 Jan 22Markdown Code Block: Including Code In .md Files - Markdown LandLearn three ways to insert a Markdown code block in your document, including a method that supports syntax highlighting.Est. reading time: 3 minutes
2024-09-24T02:19:34Z
Probably the same problem as this one.GitHubMandatory Hugging Face token to use HuggingFaceEndpoint ·...Checked other resources I added a very descriptive title to this question. I searched the LangChain documentation with the integrated search. I used the GitHub search to find a similar question and...huggingface.coLogin and logoutWe’re on a journey to advance and democratize artificial intelligence through open source and open science.
2024-09-24T03:47:28Z
I deleted the token before posting here actually .
2024-09-24T04:11:22Z
Screenshot 2024-09-24 0938331498×258 12.4 KBfrom langchain.prompts import PromptTemplate
from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain.schema.runnable import RunnableSequence
from huggingface_hub import login

# Set HuggingFace API token
os.environ['HUGGINGFACEHUB_API_TOKEN'] = 'REDACTED_TOKEN'

# Define the prompt template
prompt = PromptTemplate(
    input_variables=["product"],
    template="Tell me a good company name that makes this product: {product}"
)

# Initialize the HuggingFace endpoint
llm = HuggingFaceEndpoint(repo_id='google/flan-t5-large', temperature=0, max_new_tokens=250)

# Create a runnable sequence with the prompt and LLM
chain = RunnableSequence(prompt, llm)

# Invoke the chain and handle potential errors
try:
    result = chain.invoke({'product': 'coffee'})
    print(result)
except Exception as e:
    print("Error occurred:", e)
2024-09-24T04:13:11Z
{‘product’: ‘coffee’}The error message is broken in the middle, but it seems to be grammatically incorrect here. Perhaps the option is obsolete or the option name is incorrect.But here it is, no matter how you look at it…I wonder if the options of the other functions in the chain are broken.
2024-09-24T04:22:50Z
I removed that line .  But it is still showing the same error “HTTPError”.from langchain.prompts import PromptTemplate
from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain.schema.runnable import RunnableSequence
from huggingface_hub import login

# Set HuggingFace API token
os.environ['HUGGINGFACEHUB_API_TOKEN'] = 'my_api_token'

# Define the prompt template
prompt = PromptTemplate(
    input_variables=["product"],
    template="Tell me a good company name that makes this product: {product}"
)

# Initialize the HuggingFace endpoint
llm = HuggingFaceEndpoint(repo_id='google/flan-t5-large', temperature=0, max_new_tokens=250)

# Create a runnable sequence with the prompt and LLM
chain = RunnableSequence(prompt, llm)

chain.invoke('coffee')
2024-09-24T04:25:19Z
It’s an HTTPError, but the server is telling you that the request is wrong.This means that the function is working on the server, and the function is misinterpreting some of the options.I think it’s thepromptthat’s suspicious, I think the LLM is correct.https://python.langchain.com/v0.2/api_reference/core/prompts/langchain_core.prompts.prompt.PromptTemplate.htmlBut I don’t think there’s anything wrong with the prompt, either.huggingface.coHugging Face x LangChain : A new partner packageWe’re on a journey to advance and democratize artificial intelligence through open source and open science.I’m a little suspicious of the lack of task, because LLM can do a lot of things. Especially the ones that are closer to VLM.from langchain_huggingface import HuggingFaceEndpoint

llm = HuggingFaceEndpoint(
    repo_id="unsloth/Meta-Llama-3.1-8B-bnb-4bit", # since official one is gated,
    task="text-generation",
    max_new_tokens=100,
    do_sample=False,
)
llm.invoke("Hugging Face is")Also, I think you have to set do_sample to True for the temperature to work. Or delete temperature.github.com/hiyouga/LLaMA-FactoryUserWarning('`do_sample` is set to `False`. However, `temperature` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.'), UserWarning('`do_sample` is set to `False`. However, `top_p` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.')]opened09:02PM - 13 Mar 24 UTCclosed07:00AM - 14 Mar 24 UTCGSalimpsolved### Reminder

- [X] I have read the README and searched the existing issues.

##…# Reproduction

from llmtuner import export_model
export_model(dict(
  model_name_or_path="NousResearch/Llama-2-7b-chat-hf",
  adapter_name_or_path="/content/LLaMA-Factory/saves/LLaMA2-7B-Chat/lora/train_2024-03-13-20-49-08",
  finetuning_type="lora",
  template="llama2",
  export_dir="test_exported",
  export_hub_model_id="GSalimp/TesteExport",
))


ValueError: The generation config instance is invalid -- `.validate()` throws warnings and/or exceptions. Fix these issues to save the configuration.

Thrown during validation:
[UserWarning('`do_sample` is set to `False`. However, `temperature` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.'), UserWarning('`do_sample` is set to `False`. However, `top_p` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.')]

### Expected behavior

_No response_

### System Info

_No response_

### Others

_No response_
2024-09-24T04:47:38Z
Yess the LLM model had the issue  . Thank You John .Screenshot 2024-09-24 1015211511×383 22 KB# Initialize the HuggingFace endpoint with correct parameters (without extra model_kwargs)
llm = HuggingFaceEndpoint(
    repo_id="meta-llama/Meta-Llama-3-8B-Instruct",
    task="text-generation",
    max_new_tokens=100,
    do_sample=False,
)
# Create a runnable sequence with the prompt and LLM
chain = RunnableSequence(prompt, llm)

chain.invoke("Hugging Face")
2024-09-24T04:48:54Z
I did it. So if I turn off temperature, maybe it will work? Also, put a task on it. The rest should be correct.do_sample=False,It’s just a default value.
2024-09-24T04:52:38Z
yep it is working without adding the temperature.
2024-09-24T16:52:47Z
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.