【Rust日报】Embeding Anything

[new lib] model-mapper

这个库提供了一个宏,用于实现在不产生模板代码的情况下在各种类型(包括枚举和结构体)之间进行转换的函数。

它还提供了一个包含一些实用工具的模块,用于在类型之间进行转换,这些类型没有实现 Into trait。

最常见用例是在服务上的域实体和面向外部的模型或 DTO 之间进行映射。

#[derive(Mapper)]
#[mapper(from, ty = Entity)]
pub struct Model {
    id: i64,
    name: String,
}

上面的宏扩展将生成类似以下内容:

impl From<Entity> for Model {
    fn from(Entity { id, name }: Entity) -> Self {
        Self {
            id: Into::into(id),
            name: Into::into(name),
        }
    }
}

GitHub: https://github.com/lasantosr/model-mapper

[new lib] normal_pack

这种有损压缩方案能够实现高达6:1的压缩比,平均误差率低于1个点,具体取决于选择了哪种表示方式。

示例如下:

let normal = [-0.5082557, 0.54751796, 0.6647558];

let encoded = normal_pack::EncodedUnitVector3U8::encode(normal);
let decoded = encoded.decode();

assert_eq!(decoded, [-0.52032965, 0.5473598, 0.6554802]);

GitHub: https://github.com/Davidster/normal_pack

[new lib] EmbedAnything

一种极简但高性能、轻量级、多源、多模态和本地嵌入解决方案,内置 Rust。

EmbedAnything 是一个功能强大的 Python 库,旨在简化嵌入管道的创建和管理。无论是文本、图像、音频、PDF、网站还是其他媒体,EmbedAnything 都能简化从各种来源生成嵌入并将其存储在矢量数据库中的过程。

import embed_anything

# file
import embed_anything
data = embed_anything.embed_file("file_path.pdf", embeder= "Bert")
embeddings = np.array([data.embedding for data in data])

# image
data = embed_anything.embed_directory("directory_path", embeder= "Clip")
embeddings = np.array([data.embedding for data in data])

# audio
data = embed_anything.embed_file("file_path.wav", embeder="Whisper-Bert")

GitHub: https://github.com/StarlightSearch/EmbedAnything

[new lib] pixakit

自托管图像调整大小:即时生成图像,无需在图像大小调整服务中支付额外费用。支持Amazon、Azure和Google Cloud。

GitHub: https://github.com/JussMor/pixakit


From 日报小组 长琴

社区学习交流平台订阅:

  • Rustcc 论坛:支持 rss

  • 微信公众号:Rust 语言中文社区

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值