GithubHelp home page GithubHelp logo

Comments (4)

shiyu22 avatar shiyu22 commented on August 10, 2024

@wzt-lx Which version of Milvus are you using? Actually Milvus support varchar datatype now, please update to the newest version.

from examples.

wzt-lx avatar wzt-lx commented on August 10, 2024

c5ea2019b632 milvusdb/milvus:v2.0.2 "/tini -- milvus run…" 5 days ago Up 2 hours 0.0.0.0:19530->19530/tcp milvus-standalone
6e594cc20871 quay.io/coreos/etcd:v3.5.0 "etcd -advertise-cli…" 5 days ago Up 2 hours 2379-2380/tcp milvus-etcd
76add99367b6 minio/minio:RELEASE.2020-12-03T00-03-10Z "/usr/bin/docker-ent…" 5 days ago Up 2 hours (healthy) 9000/tcp milvus-minio
pymilvus 2.0.2

from examples.

wzt-lx avatar wzt-lx commented on August 10, 2024

def create_milvus_collection(collection_name, dim):
if utility.has_collection(collection_name):
utility.drop_collection(collection_name)

fields = [
FieldSchema(name='id', dtype=DataType.VARCHAR, descrition='ids', max_length=500, is_primary=True, auto_id=False),
FieldSchema(name='embedding', dtype=DataType.FLOAT_VECTOR, descrition='embedding vectors', dim=dim)
]
schema = CollectionSchema(fields=fields, description='reverse image search')
collection = Collection(name=collection_name, schema=schema)

# create IVF_FLAT index for collection.
index_params = {
    'metric_type':'L2',
    'index_type':"IVF_FLAT",
    'params':{"nlist":2048}
}
collection.create_index(field_name="embedding", index_params=index_params)
return collection

collection = create_milvus_collection('question_answer', 768)

AttributeError Traceback (most recent call last)
Cell In[5], line 21
18 collection.create_index(field_name="embedding", index_params=index_params)
19 return collection
---> 21 collection = create_milvus_collection('question_answer', 768)

Cell In[5], line 6, in create_milvus_collection(collection_name, dim)
2 if utility.has_collection(collection_name):
3 utility.drop_collection(collection_name)
5 fields = [
----> 6 FieldSchema(name='id', dtype=DataType.VARCHAR, descrition='ids', max_length=500, is_primary=True, auto_id=False),
7 FieldSchema(name='embedding', dtype=DataType.FLOAT_VECTOR, descrition='embedding vectors', dim=dim)
8 ]
9 schema = CollectionSchema(fields=fields, description='reverse image search')
10 collection = Collection(name=collection_name, schema=schema)

File D:\anaconda\envs\DL\lib\enum.py:429, in EnumMeta.getattr(cls, name)
427 return cls.member_map[name]
428 except KeyError:
--> 429 raise AttributeError(name) from None

AttributeError: VARCHAR

from examples.

junjiejiangjjj avatar junjiejiangjjj commented on August 10, 2024

requires pymilvus >= 2.1

from examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.