TypeError: encode() missing 1 required positional argument: 'text' when running CSV example
I am running the example code for CSV data given in the README, but I encounter the following error: TypeError: encode() missing 1 required positional argument: 'text' It seems that the tokenizer.encode(seq) call fails because encode() is not being called with the expected arguments, or the tokenizer object is not of the expected type. The checkpoint is automatically downloaded by the code itself. Has anyone encountered this problem and any solution to this problem?
Here is the full error log
log_filepath: /home/featurize/work/LucaOneApp/models/llm/logs/lucaone/lucaone/logs.txt
model_dirpath: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000
Model dirpath: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000
Alphabet, vocab path: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000/tokenizer
Load pretrained model: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000
input seq type: gene
args device: cuda:0
emb save dir: /home/featurize/work/LucaOneApp/embedding/lucaone/test_data/gene/test_gene
Traceback (most recent call last):
File "/home/featurize/work/LucaOneApp/algorithms/inference_embedding_lucaone.py", line 183, in
Here is the full code
I create the env as in the readme conda create -n lucaone_app python=3.9.13 conda activate lucaone_app pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
After auto-downloading the TrainedCheckPoint: LucaOne-lucaone-lucaone-36000000 It goes to TypeError: encode() missing 1 required positional argument: 'text'
(lucaone_app) ➜ algorithms python inference_embedding_lucaone.py
--llm_dir ../models
--llm_type lucaone
--llm_version lucaone
--llm_step 36000000
--truncation_seq_length 10240
--trunc_type right
--seq_type gene
--input_file ../data/test_data/gene/test_gene.csv
--id_idx 0
--seq_idx 1
--save_path ../embedding/lucaone/test_data/gene/test_gene/
--save_type numpy
--embedding_type matrix
--matrix_add_special_token
--embedding_complete
--embedding_complete_seg_overlap
--gpu_id 0
2025-08-14 03:58:19.133588: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2025-08-14 03:58:20.025685: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2025-08-14 03:58:20.025807: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2025-08-14 03:58:20.025832: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
import apex err: No module named 'apex'
--------------------Input Args:--------------------
{'embedding_complete': True, 'embedding_complete_seg_overlap': True, 'embedding_fixed_len_a_time': None, 'embedding_type': 'matrix', 'gpu_id': 0, 'id_idx': 0, 'input_file': '../data/test_data/gene/test_gene.csv', 'llm_dir': '../models', 'llm_step': '36000000', 'llm_type': 'lucaone', 'llm_version': 'lucaone', 'matrix_add_special_token': True, 'save_path': '../embedding/lucaone/test_data/gene/test_gene/', 'save_type': 'numpy', 'seq': None, 'seq_id': None, 'seq_idx': 1, 'seq_type': 'gene', 'trunc_type': 'right', 'truncation_seq_length': 10240, 'vector_type': 'mean'}
Args: Namespace(seq_id=None, seq=None, seq_type='gene', input_file='../data/test_data/gene/test_gene.csv', id_idx=0, seq_idx=1, save_path='../embedding/lucaone/test_data/gene/test_gene/', llm_dir='../models', llm_type='lucaone', llm_version='lucaone', llm_step='36000000', embedding_type='matrix', save_type='numpy', vector_type='mean', trunc_type='right', truncation_seq_length=10240, matrix_add_special_token=True, embedding_complete=True, embedding_complete_seg_overlap=True, embedding_fixed_len_a_time=None, gpu_id=0)
/home/featurize/work/LucaOneApp/models/llm/logs/lucaone/lucaone/logs.txt not exists. Downloading Downloading LucaOne TrainedCheckPoint: LucaOne-lucaone-lucaone-36000000 ... Wait a moment(total 8GB), please. Downloading logs.txt... Downloaded logs.txt Downloading config.json... Downloaded config.json Downloading pytorch.pth... Downloaded pytorch.pth Downloading training_args.bin... Downloaded training_args.bin Downloading tokenizer/alphabet.pkl... Downloaded tokenizer/alphabet.pkl LucaOne Download Completed.
log_filepath: /home/featurize/work/LucaOneApp/models/llm/logs/lucaone/lucaone/logs.txt
model_dirpath: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step36000000
Model dirpath: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step36000000
Alphabet, vocab path: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step36000000/tokenizer
Load pretrained model: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step36000000
input seq type: gene
args device: cuda:0
emb save dir: /home/featurize/work/LucaOneApp/embedding/lucaone/test_data/gene/test_gene
Traceback (most recent call last):
File "/home/featurize/work/LucaOneApp/algorithms/inference_embedding_lucaone.py", line 183, in
I am running the example code for CSV data given in the README, but I encounter the following error: TypeError: encode() missing 1 required positional argument: 'text' It seems that the tokenizer.encode(seq) call fails because encode() is not being called with the expected arguments, or the tokenizer object is not of the expected type. The checkpoint is automatically downloaded by the code itself. Has anyone encountered this problem and any solution to this problem?
Here is the full error log log_filepath: /home/featurize/work/LucaOneApp/models/llm/logs/lucaone/lucaone/logs.txt model_dirpath: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000 Model dirpath: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000 Alphabet, vocab path: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000/tokenizer Load pretrained model: /home/featurize/work/LucaOneApp/models/llm/models/lucaone/lucaone/checkpoint-step17600000 input seq type: gene args device: cuda:0 emb save dir: /home/featurize/work/LucaOneApp/embedding/lucaone/test_data/gene/test_gene Traceback (most recent call last): File "/home/featurize/work/LucaOneApp/algorithms/inference_embedding_lucaone.py", line 183, in main(run_args) File "/home/featurize/work/LucaOneApp/algorithms/llm/lucagplm/get_embedding.py", line 865, in main emb, processed_seq_len = predict_embedding( File "/home/featurize/work/LucaOneApp/algorithms/llm/lucagplm/get_embedding.py", line 391, in predict_embedding emb, processed_seq_len = get_embedding( File "/home/featurize/work/LucaOneApp/algorithms/llm/lucagplm/get_embedding.py", line 280, in get_embedding batch, processed_seq_len = encoder(args_info, model_config, seq, seq_type, tokenizer) File "/home/featurize/work/LucaOneApp/algorithms/llm/lucagplm/get_embedding.py", line 175, in encoder seq_encoded_list = [tokenizer.encode(seq)] TypeError: encode() missing 1 required positional argument: 'text'
Apologies for the late reply. This bug was caused by a recent code update. I've now fixed the issue in the master branch. Could you please pull the latest changes from master and try again? Sorry for the inconvenience.
Thanks!