Point in file import
Closed this issue · 2 comments
System Info
latest commit
Environment/Platform
- Website/web-app
- Browser extension
- Server-side (e.g., Node.js, Deno, Bun)
- Desktop app (e.g., Electron)
- Other (e.g., VSCode extension)
Description
Leave this point please 🫥
https://github.com/huggingface/transformers.js/blob/main/scripts/convert.py#L20
Reproduction
$ python convert.py help
Traceback (most recent call last):
File "/transformers.js/scripts/convert.py", line 20, in
from .quantize import QuantizationArguments, quantize
ImportError: attempted relative import with no known parent package
instead of:
usage: convert.py [-h] --model_id MODEL_ID [--tokenizer_id TOKENIZER_ID]
[--quantize [QUANTIZE]]
[--output_parent_dir OUTPUT_PARENT_DIR] [--task TASK]
[--library_name LIBRARY_NAME] [--variant VARIANT]
[--opset OPSET] [--device DEVICE]
[--skip_validation [SKIP_VALIDATION]]
[--output_attentions [OUTPUT_ATTENTIONS]]
[--split_modalities [SPLIT_MODALITIES]]
[--trust_remote_code [TRUST_REMOTE_CODE]]
[--custom_onnx_configs CUSTOM_ONNX_CONFIGS]
[--skip_onnxslim [SKIP_ONNXSLIM]]
[--modes {fp16,q8,int8,uint8,q4,q4f16,bnb4} [{fp16,q8,int8,uint8,q4,q4f16,bnb4} ...]]
[--per_channel [PER_CHANNEL]]
[--reduce_range [REDUCE_RANGE]] [--block_size BLOCK_SIZE]
[--is_symmetric [IS_SYMMETRIC]] [--no_is_symmetric]
[--accuracy_level ACCURACY_LEVEL] [--quant_type {0,1}]
convert.py: error: the following arguments are required: --model_id
Hi there 👋 this is intended, and the correct way to run the script is as a python module with the -m
flag (see README):
python -m scripts.convert --quantize --model_id <model_name_or_path>