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

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 100: ordinal not in range(128) #13

Closed
MiladAlshomary opened this issue Mar 14, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MiladAlshomary
Copy link

Hi,

I am running to an "ascii error" whenever I use the library with models loaded from HFTransformers. The code runs perfectly with other llms like OpenAI or MistralAI.

Example code:

with DataDreamer("./test"):
  hrs_dataset = DataSource('hrs_documents', Dataset.from_list([{'text':'article 1 text'}, {'text':'article 2 text'}]))
  model  = HFTransformers("tiiuae/falcon-40b-instruct", device_map="auto")
  
  hrs_dataset = hrs_dataset.take(10)
  output_dataset = ProcessWithPrompt(
      "Mine arguments from texts",
      inputs={"inputs": hrs_dataset.output['text']},
      args={
          "llm": model,
          "Temperature": 1.2,
          "instruction": (
              "summarize the text"
          ),
      },
      outputs={"inputs": "fullText", "generations": "summaries"},
  )
  
  output_dataset.save()
@AjayP13
Copy link
Collaborator

AjayP13 commented Mar 14, 2024

Solved by setting the LC_ALL environment variable (some Linux machines don't have this configured properly):

export LC_ALL=C.UTF-8

@AjayP13 AjayP13 closed this as completed Mar 14, 2024
@AjayP13
Copy link
Collaborator

AjayP13 commented Mar 22, 2024

For my own future reference, I added a block of code here:

b48b58e

That sets the locale/encoding to utf8 for users who many have a system that is not properly configured, without them having to use the LC_ALL environment variable. This is difficult to test for, so it may or may not work for everyone.

@AjayP13 AjayP13 added the bug Something isn't working label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants