当前位置: 首页 > news >正文

唐山 建设工程信息网站下关汇做网站的公司

唐山 建设工程信息网站,下关汇做网站的公司,百度网盘网页版登录,新颖的互联网公司名字在处理插入milvus数据时,设置了字段长度为512. 明明考虑了预留,插入的数据中没有这么长的,但还是会有报错 类似:MilvusException: (code0, messagethe length (564) of 78th string exceeds max length (512) 查找max(len(x) for …

在处理插入milvus数据时,设置了字段长度为512. 明明考虑了预留,插入的数据中没有这么长的,但还是会有报错 类似:MilvusException: (code=0, message=the length (564) of 78th string exceeds max length (512)
查找max(len(x) for x in temp_list)之类  都没有超过512过,也没超过256过,不知道哪里的数据有问题..
反复截段文本等测试后发现,例如用len(x)看到的字符串长度是10,但保存进milus的长度,并不是..

举例,把数据库长度设为一个小值16:
FieldSchema(name="question", dtype=DataType.VARCHAR, auto_id=False, max_length=16)

再把数据缩到只有一行 测试结果插入成功:

line contents is : 你好呀你好 and length is 5
Batches: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.02s/it]
index handle result: Status(code=0, message=)
insert result: (insert count: 1, delete count: 0, upsert count: 0, timestamp: 449735609509740549, success count: 1, err count: 0)

再增加一点文字长度 就报错了:

line contents is : 你好呀你好呀 and length is 6
Batches: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  1.03it/s]
index handle result: Status(code=0, message=)
[2024-05-13 20:59:27,915 decorators.py:134                              ERROR] RPC error: [batch_insert], <MilvusException: (code=0, message=the length (18) of 0th string exceeds max length (16))>, <Time:{'RPC start': '2024-05-13 20:59:27.912751', 'RPC error': '2024-05-13 20:59:27.915058'}>
Traceback (most recent call last):
  File "/root/temp_dir/run_task.py", line 55, in <module>
    XXX().create_insert_vector_db()
  File "/root/temp_dir/app/service/vector_db/xx_pre_handle.py", line 63, in create_insert_vector_db
    ).get_or_create_db(fields, description, "possible_question_embeddings", entities)
  File "/root/temp_dir/app/service/vector_db/milvus_db.py", line 23, in get_or_create_db
    return self.create_and_insert(fields, description, index_field_name, entities)
  File "/root/temp_dir/app/service/vector_db/milvus_db.py", line 28, in create_and_insert
    self.insert_db(entities)
  File "/root/temp_dir/app/service/vector_db/milvus_db.py", line 40, in insert_db
    insert_result = self.collection.insert(entities)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/orm/collection.py", line 497, in insert
    res = conn.batch_insert(
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 135, in handler
    raise e from e
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 131, in handler
    return func(*args, **kwargs)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 170, in handler
    return func(self, *args, **kwargs)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 110, in handler
    raise e from e
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 74, in handler
    return func(*args, **kwargs)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 566, in batch_insert
    raise err from err
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 560, in batch_insert
    check_status(response.status)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/client/utils.py", line 54, in check_status
    raise MilvusException(status.code, status.reason, status.error_code)
pymilvus.exceptions.MilvusException: <MilvusException: (code=0, message=the length (18) of 0th string exceeds max length (16))>


所以,可能是因为UTF-8或其他编码的原因,一些非ASCII字符可能被编码成多个字节 以保存进milvus。
所以,解决方案是 建表时FieldSchema中把max_length 设置为4倍或其他倍数于预期的最大长度。


 

http://www.yayakq.cn/news/607221/

相关文章:

  • 商城网站管理系统辽阳内蒙古网站建设
  • 查建设施工资质的网站买个购物网站
  • 福州做企业网站免费信息发布网站有哪些
  • 用python做网站开发的课程怎么创网站赚钱吗
  • 广东广州快速网站制作企业深圳公司建立网站
  • 做网站收费 优帮云开发制作一个网站
  • 网站分享设计亚洲网站建设中
  • 设计素材网站特点摄影看图网站
  • 有没有做博物馆的3d网站广点通广告投放平台
  • wordpress快站网络规划设计师希赛
  • 陕西建设注册中心网站公司注册与注销
  • 做分销网站系统跨境电商运营模式有哪些
  • 对网站建设培训的建议上海网站建设价钱
  • 定州建设厅网站wordpress免费商城模板
  • 枣庄网站制作wordpress数据库新增用户密码忘记
  • 长春网站推广网诚传媒网络广告营销的典型案例
  • 客户做网站需要提供什么莱西做网站的
  • 湛江外包做网站合肥建设云平台
  • 东莞市企业网站建设哪家好山西省住房和城乡建设厅官方网站
  • 用群晖做网站服务器wordpress 博客插件
  • 福建漳州东山建设局官方网站莱芜论坛话题
  • 网站里的友情链接推广普通话的意义50字
  • 招商加盟网站开发ui设计培训班有用吗
  • 广科网站开发厦门网页设计代做
  • 免费网站模板源码空间手机版网站目录建设
  • 磁县网站设计公司ios网站开发工具
  • 广告传媒建设网站关键词排名查询网站
  • 购物网站后台管理系统模板企业策划书格式
  • 尚义住房和城乡规划建设局网站建设网站 万网
  • 常见购物网站功能2017淘宝客网站怎么做