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

Set TOKENIZERS_PARALLELISM if not set #17

Merged
merged 1 commit into from
Aug 19, 2023
Merged

Set TOKENIZERS_PARALLELISM if not set #17

merged 1 commit into from
Aug 19, 2023

Conversation

wongjingping
Copy link
Collaborator

Previously, we used to get a warning about tokenizers_parallelism not being set. Eg:

$ python main.py \
  -q data/questions_gen.csv \
  -o results/my_query_generator.csv \
  -g oa \
  -f prompts/prompt.md \
  -m gpt-3.5-turbo-0613 \
  -n 1 \
  -p 5 \
  -v
preparing questions...
  0%|                                                                                                                                                                  | 0/1 [00:00<?, ?it/s]huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
Correct so far: 0/1 (0.00%): 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00,  2.47s/it]
Average rate of exact match: 0.00
Average correct rate: 0.00

We now set it if it's not present in the environment.
Tested locally (without the env variable set) and the warning no longer shows up:

$ python main.py \
  -q data/questions_gen.csv \
  -o results/my_query_generator.csv \
  -g oa \
  -f prompts/prompt.md \
  -m gpt-3.5-turbo-0613 \
  -n 5 \
  -p 5 \
  -v
preparing questions...
Correct so far: 3/5 (60.00%): 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:02<00:00,  1.92it/s]
Average rate of exact match: 0.60
Average correct rate: 0.60

@rishsriv rishsriv merged commit a75fdc6 into main Aug 19, 2023
4 checks passed
@wongjingping wongjingping deleted the jp/token_parallel branch August 19, 2023 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants