NeMo-Guardrails
NeMo-Guardrails copied to clipboard
1 validation error for HuggingFaceHub
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"
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.