from __future__ import annotations
from daft.las.functions.ark_llm.doubao_embedding_vision import DoubaoEmbeddingVision
from daft.las.functions.udf import las_udf
if os.getenv("DAFT_RUNNER", "native") == "ray":
def configure_logging():
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S.%s".format(),
logging.getLogger("tracing.span").setLevel(logging.WARNING)
logging.getLogger("daft_io.stats").setLevel(logging.WARNING)
logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING)
logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING)
logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING)
ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging})
daft.set_execution_config(min_cpu_per_task=0)
if __name__ == "__main__":
# 需配置环境变量 LAS_API_KEY : LAS_API_KEY 通过在 LAS 服务页面上创建获取
tos_dir_url = os.getenv("TOS_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com")
f"https://{tos_dir_url}/public/shared_image_dataset/cat_ip_adapter.jpeg"
df = daft.from_pydict(samples)
"embedding_for_image_text",
)(col("image_path"), col("text")),
"multimodal_type": "text",
# ╭────────────────────────────────┬────────┬────────────────────────────────┬────────────────────────────────┬────────────────────────────────╮
# │ image_path ┆ text ┆ embedding_for_image_text ┆ embedding_for_image ┆ embedding_for_text │
# │ --- ┆ --- ┆ --- ┆ --- ┆ --- │
# │ String ┆ String ┆ List[Float32] ┆ List[Float32] ┆ List[Float32] │
# ╞════════════════════════════════╪════════╪════════════════════════════════╪════════════════════════════════╪════════════════════════════════╡
# │ https://las-public-data-qa.to… ┆ 猫 ┆ [0.010437012, -0.009399414, -… ┆ [0.0076293945, -0.014404297, … ┆ [0.019165039, 0.007598877, -0… │
# ╰────────────────────────────────┴────────┴────────────────────────────────┴────────────────────────────────┴────────────────────────────────╯