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

1 validation error for HuggingFaceHub #662

Open
qifuxiao opened this issue Aug 6, 2024 · 1 comment
Open

1 validation error for HuggingFaceHub #662

qifuxiao opened this issue Aug 6, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@qifuxiao
Copy link

qifuxiao commented Aug 6, 2024

I run it in colab,

config.yml:

models:
  - type: main
    engine: huggingface_hub
    model: baichuan-inc/Baichuan2-7B-Chat

rails:
  input:
    flows:
      - self check input

  output:
    flows:
      - self check output

jupyter code:

import os

from google.colab import userdata
os.environ["HUGGINGFACEHUB_API_TOKEN"] = userdata.get('HUGGINGFACEHUB_API_TOKEN')
print(os.environ["HUGGINGFACEHUB_API_TOKEN"])


from nemoguardrails import RailsConfig, LLMRails

config = RailsConfig.from_path("./config")
rails = LLMRails(config)

return Error:

ValidationError                           Traceback (most recent call last)
[<ipython-input-16-285c50de0d73>](https://localhost:8080/#) in <cell line: 4>()
      2 
      3 config = RailsConfig.from_path("./config")
----> 4 rails = LLMRails(config)

3 frames
[/usr/local/lib/python3.10/dist-packages/pydantic/v1/main.py](https://localhost:8080/#) in __init__(__pydantic_self__, **data)
    339         values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)
    340         if validation_error:
--> 341             raise validation_error
    342         try:
    343             object_setattr(__pydantic_self__, '__dict__', values)

ValidationError: 1 validation error for HuggingFaceHub
__root__
  Must specify either `repo_id` or `task`, or both. (type=value_error)`

how can I use it in "baichuan-inc/Baichuan2-7B-Chat"

@drazvan
Copy link
Collaborator

drazvan commented Aug 6, 2024

Just based on the error, I guess you have to do something like:

models:
  - type: main
    engine: huggingface_hub
    model: baichuan-inc/Baichuan2-7B-Chat
    parameters:
      task: "..."
      repo_id: "..."

Let me know if this works.

@drazvan drazvan self-assigned this Aug 6, 2024
@drazvan drazvan added the question Further information is requested label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants