anarchy-ai / LLM-VM

irresponsible innovation. Try now at https://chat.dev/
https://anarchy.ai/
MIT License
481 stars 145 forks source link

HuggingFace Token #429

Closed AfamO closed 10 months ago

AfamO commented 10 months ago

Describe the bug Hugging Face is asking for token to access and run Llam2 model

To Reproduce Steps to reproduce the behavior:

  1. Import Client from llm_vm
  2. Try performing completion request using llam2 as big_model.
  3. Then run the python code . See the attached screen shot.
  4. See error. See the attached screen shot

Expected behavior Before invoking the model, Hugging Face expects a token having permission to the repo to be passed either via huggingface-cli loginor by passingtoken=`.

Screenshots llm_vm llama2 error

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

wansatya commented 10 months ago

You can manage the HF login using from huggingface_hub import login

import sys
import os
# Import our client
from llm_vm.client import Client
# Import huggingface hub login
from huggingface_hub import login

# Login with HF API token
login(
    os.getenv("LLM_VM_HUGGINGFACEHUB_API_TOKEN")
)

# Instantiate the client specifying which LLM you want to use
client = Client(
    big_model='llama2'
)

# Put in to your prompt and go!
response = client.complete(
    context='',
    prompt = 'What is anarchy?'
)
print(
    response, file=sys.stderr
) # Anarchy is a political system in which the state is abolished and the people are free...
AfamO commented 10 months ago

It's alright. The above step, along with extra efforts to request for repo access from both Meta and Hugging Face websites, worked