[Python] 使用 format_map() 將變數值填充於字串中
前陣子閱讀了不少 LLaMA 的各種 LoRA 模型訓練(雖然已經大概是兩個月前…),在閱讀各家程式碼的時候,發現在程式碼中設定給予模型的 prompt 時,若需要根據不同的資料調整內容,使用 format_map() 的格式看起來最為乾淨。
前陣子閱讀了不少 LLaMA 的各種 LoRA 模型訓練(雖然已經大概是兩個月前…),在閱讀各家程式碼的時候,發現在程式碼中設定給予模型的 prompt 時,若需要根據不同的資料調整內容,使用 format_map() 的格式看起來最為乾淨。
Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and an array edges where edges[i] = [fromi, toi] represents a directed edge from node fromi to node toi.
Faiss 是 Facebook AI Research 團隊所開發的一款高效向量匹配函式庫,只要輸入向量後,就能夠在大量的高維度向量中迅速匹配最相像的 top k 個向量。
Read More »[Python] 使用 Faiss 相似度搜索快速匹配向量Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where:
answer[0] is a list of all distinct integers in nums1 which are not present in nums2.answer[1] is a list of all distinct integers in nums2 which are not present in nums1.There is a function signFunc(x) that returns:
You have a set which contains all positive integers [1, 2, 3, 4, 5, ...].
Implement the SmallestInfiniteSet class:
You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string.
There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have.