MemoryLayout | Apple Developer Documentation
Useful documentation for MemoryLayout
Started working on memory mapping with a really long mistake by working with hnsw as a HNSWCorpus in the ContextFreeEncoder leading to a circular dependency.
Added Codable conformances with encoding and decoding for HNSWCorpus (unused) and DeterministicSampleVectorIndex for requirement in ContextFreeEncoder with file I/O. Should correctly set the foundation for reading and writing the HNSW index to and from a memory map.
Added extra PreComputedEmbeddings enumeration for hnswindex for the corresponding memory map file. Added corresponding changes to initializer.
Minor improvements and bug fixes:
count in HNSWCorpuszeroes to computed field in HNSWCorpusHNSWCorpus to DictionaryCorpustypicalNeighborhoodSize field to DeterministicSampleVectorIndex with default 20Tests:
HNSWCorpus, interestingly the corpus is only 8 bytes for both the basic and small test caseHNSWCorpus in HNSWTests, it successfully finds vectors but it returns it in a raw formattypicalNeighborHoodSize variations, but oddly crashes after 0AllMiniLM_pipelineTest.swift, unable to find dependency for TestUtilswidth (assuming this is dimension) to be 50 in ContextFreeEncoder for the HNSW index. How should I go about verifying what the actual dimension is?You don’t. Everything in ContextFreeEncoder doesn’t need to be touched. We are focused on using glove embeddings for now.
Create an extension on HNSWCorpus which allows us to read and write to a file. We will likely need to write it into a Data object with .alwaysMapped.