Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 1024, 'do_lower_case': False, 'architecture': 'OptimizedModule'})
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("modernbert-code-v4-hard-negatives")
5# Run inference
6queries = [
7 "If MultiTenantMiddleware is used, filter queryset by request.site_id",
8]
9documents = [
10 "def get_queryset(self):\n '''\n If MultiTenantMiddleware is used, filter queryset by request.site_id\n '''\n queryset = super(PageList, self).get_queryset()\n if hasattr(self.request, 'site_id'):\n queryset = queryset.filter(site_id=self.request.site_id)\n return queryset",
11 'def reduce_ticks(ax, which, maxticks=3):\n """Given a pyplot axis, resamples its `which`-axis ticks such that are at most\n `maxticks` left.\n\n Parameters\n ----------\n ax : axis\n The axis to adjust.\n which : {\'x\' | \'y\'}\n Which axis to adjust.\n maxticks : {3, int}\n Maximum number of ticks to use.\n\n Returns\n -------\n array\n An array of the selected ticks.\n """\n ticks = getattr(ax, \'get_{}ticks\'.format(which))()\n if len(ticks) > maxticks:\n # make sure the left/right value is not at the edge\n minax, maxax = getattr(ax, \'get_{}lim\'.format(which))()\n dw = abs(maxax-minax)/10.\n start_idx, end_idx = 0, len(ticks)\n if ticks[0] < minax + dw:\n start_idx += 1\n if ticks[-1] > maxax - dw:\n end_idx -= 1\n # get reduction factor\n fac = int(len(ticks) / maxticks)\n ticks = ticks[start_idx:end_idx:fac]\n return ticks',
12 'function (isPublic, name, data, ttl, published_at, coreid) {\n var rawFn = function (msg) {\n try {\n msg.setMaxAge(parseInt((ttl && (ttl >= 0)) ? ttl : 60));\n if (published_at) {\n msg.setTimestamp(moment(published_at).toDate());\n }\n }\n catch (ex) {\n logger.error("onCoreHeard - " + ex);\n }\n return msg;\n };\n\n var msgName = (isPublic) ? "PublicEvent" : "PrivateEvent";\n var userID = (this.userID || "").toLowerCase() + "/";\n name = (name) ? name.toString() : name;\n if (name && name.indexOf && (name.indexOf(userID) == 0)) {\n name = name.substring(userID.length);\n }\n\n data = (data) ? data.toString() : data;\n this.sendNONTypeMessage(msgName, { event_name: name, _raw: rawFn }, data);\n }',
13]
14query_embeddings = model.encode_query(queries)
15document_embeddings = model.encode_document(documents)
16print(query_embeddings.shape, document_embeddings.shape)
17# [1, 768] [3, 768]
18
19# Get the similarity scores for the embeddings
20similarities = model.similarity(query_embeddings, document_embeddings)
21print(similarities)
22# tensor([[ 0.8836, -0.0275, 0.0176]])evalInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.8943 |
| cosine_accuracy@3 | 0.943 |
| cosine_accuracy@5 | 0.963 |
| cosine_accuracy@10 | 0.976 |
| cosine_precision@1 | 0.8943 |
| cosine_precision@3 | 0.3143 |
| cosine_precision@5 | 0.1926 |
| cosine_precision@10 | 0.0976 |
| cosine_recall@1 | 0.8943 |
| cosine_recall@3 | 0.943 |
| cosine_recall@5 | 0.963 |
| cosine_recall@10 | 0.976 |
| cosine_ndcg@10 | 0.9359 |
| cosine_mrr@10 | 0.9229 |
| cosine_map@100 | 0.924 |
query, positive, negative_0, negative_1, negative_2, negative_3, negative_4, and negative_5| query | positive | negative_0 | negative_1 | negative_2 | negative_3 | negative_4 | negative_5 | |
|---|---|---|---|---|---|---|---|---|
| type | string | string | string | string | string | string | string | string |
| details |
|
|
|
|
|
|
|
|
| query | positive | negative_0 | negative_1 | negative_2 | negative_3 | negative_4 | negative_5 |
|---|---|---|---|---|---|---|---|
A valid parentheses sequence is a non-empty string where each character is either '(' or ')', which satisfies the following constraint:[object Object][object Object]You can find a way to repeat erasing adjacent pairs of parentheses '()' until it becomes empty.[object Object][object Object] For example, '(())' and '()((()()))' are valid parentheses sequences, but ')()(' and '(()' are not.[object Object][object Object] Mike has a valid parentheses sequence. He really likes everything about his sequence, except the fact that it is quite long. So Mike has recently decided that he will replace his parentheses sequence with a new one in the near future. But not every valid parentheses sequence will satisfy him. To help you understand his requirements we'll introduce the pseudocode of function F(S):[object Object][object Object] FUNCTION F( S - a valid parentheses sequence )[object Object] BEGIN[object Object] balance = 0[object Object] max_balance = 0[object Object] FOR index FROM 1 TO LENGTH(S)[object Object] BEGIN[object Object] if S[index] == '(' then balance = balance + 1[object Object] if S[index] == ')' then balance = balance - 1[object Object] max_balance = max( max_balance, balance )[object Object] END[object Object] ... | try:[object Object] for i in range(int(input())):[object Object] s=input()[object Object] balance=0[object Object] max_balance=0[object Object] for i in s:[object Object] if i=='(':balance+=1[object Object] else:[object Object] balance-=1[object Object] max_balance=max(max_balance,balance)[object Object] print('('*max_balance,')'*max_balance,sep="")[object Object]except Exception as e:[object Object] print(e)[object Object] | t=int(input())[object Object][object Object]for tt in range(t):[object Object] a,b,p=map(int,input().split())[object Object] s=input()[object Object] n=len(s)[object Object] cost = [0]*n[object Object] cost[-1] = 0[object Object] typ = ''[object Object] i=n-2[object Object] while i>=0:[object Object] if s[i]==typ:[object Object] cost[i] = cost[i+1][object Object] else:[object Object] typ = s[i][object Object] cost[i] = cost[i+1] + (a if typ=='A' else b)[object Object] i-=1[object Object] i=0[object Object] while cost[i] > p:[object Object] i+=1[object Object] print(i+1) | test=int(input())[object Object]for i in range(test):[object Object] s=input()[object Object] b=len(s)[object Object] list1=[][object Object] for j in range(len(s)):[object Object] if s[j]=='.':[object Object] list1.append(j)[object Object] for i in list1:[object Object] if b-i-1 in list1 :[object Object] if i!=b-i-1 and ((s[i] and s[b-i-1]) != 'a' ):[object Object] s=s[:i]+'a'+s[i+1:b-i-1]+'a'+s[b-i:][object Object] else:[object Object] s=s[:i]+'a'+s[i+1:][object Object] else:[object Object] s=s[:i]+s[b-i-1]+s[i+1:][object Object][object Object] if s==s[::-1]:[object Object] print(s)[object Object] else:[object Object] print(-1)[object Object][object Object] | from collections import Counter | |||
def solve(A,B): | |||||||
a = Counter(A) | |||||||
b = Counter(B) | |||||||
ans = 0 | |||||||
for i in a: | |||||||
if i in b: | |||||||
ans += min(a[i],b[i]) |
l=list(map(int,input()))[object Object]t=-1[object Object]x=-1[object Object]y=-1[object Object]for i in range(len(l)):[object Object] s=l[i][object Object] a=i+1[object Object] b=i+1[object Object] for j in range(i+1,len(l)):[object Object] if l[i][object Object] | t=eval(input())[object Object] [object Object]a=[][object Object]b=[][object Object] [object Object]top=-1[object Object] [object Object]for __ in range(0,t):[object Object] [object Object] x=input().split()[object Object] [object Object] if(x[0]!="-1" and x[0]!="0"):[object Object] [object Object] add=int(x[0])[object Object] [object Object] if top!=-1 and add>a[top][0] :[object Object] [object Object] b[top]+=1[object Object] [object Object] else:[object Object] a.append((add,x[1]))[object Object] [object Object] b.append(0)[object Object] top+=1[object Object] [object Object] [object Object] elif (x[0]=="-1"):[object Object] [object Object] #print("%s %s" %(b[top],a[top][1]))[object Object] print((b[top]), end=' ')[object Object] print(a[top][1])[object Object] foo=a.pop()[object Object] bar=b.pop()[object Object] top-=1 | t=eval(input())[object Object] [object Object]a=[][object Object]b=[][object Object] [object Object]top=-1[object Object] [object Object]for __ in range(0,t):[object Object] [object Object] x=input().split()[object Object] [object Object] if(x[0]!="-1" and x[0]!="0"):[object Object] [object Object] add=int(x[0])[object Object] [object Object] if top!=-1 and add>a[top][0] :[object Object] [object Object] b[top]+=1[object Object] [object Object] else:[object Object] a.append((add,x[1]))[object Object] [object Object] b.append(0)[object Object] top+=1[object Object] [object Object] [object Object] elif (x[0]=="-1"):[object Object] [object Object] #print("%s %s" %(b[top],a[top][1]))[object Object] print((b[top]), end=' ')[object Object] print(a[top][1])[object Object] foo=a.pop()[object Object] bar=b.pop()[object Object] top-=1 |
| Chef has a cubic die with 6 faces kept on an infinite plane. Each face has a distinct integer in the range [1,6] written on it, but the exact arrangement of the numbers on the faces of the die is unknown to Chef. Curiosity gets the better of Chef and he wants to find out o(1), o(2), ..., o(6), where o(i) is the number written opposite to the number i.[object Object][object Object] Chef performs the following N-1 steps to learn the exact arrangement of the numbers on the die. In the i-th step, Chef pushes the die in some direction (there are 4 possible directions), and the die rolls 90o in this direction. The picture below demonstrates a die and the result that it produced after rolling in each of the 4 directions respectively. For this die, we have o(1)=4, o(2)=5, o(3)=6, o(4)=1, o(5)=2, o(6)=3.[object Object][object Object] Chef records N numbers A1, A2, ..., AN, where Ai is the number written on the top of the die before the i-th step. However, the information on the direction in which he pushes the die each time are lost. Can you help h... | from itertools import permutations[object Object][object Object]def solve(n,a):[object Object] ans=[][object Object] [object Object] for des in desire:[object Object] check=1[object Object] for i in range(n-1):[object Object] [object Object] if (a[i]==a[i+1]):[object Object] return [-1][object Object] if a[i+1]==des[a[i]-1]:[object Object] check=0[object Object] break[object Object] if check:[object Object] ans=des[object Object] break[object Object] if ans:[object Object] return ans[object Object] return [-1][object Object] [object Object][object Object]per=permutations([1,2,3,4,5,6])[object Object]desire=[][object Object]for p in per:[object Object] check=1[object Object] for i in range(1,7):[object Object] if p[i-1]==i:[object Object] check=0[object Object] break[object Object] if check:[object Object] doublecheck=1[object Object] for i in range(6):[object Object] if p[p[i]-1]!=i+1:[object Object] doublecheck=0[object Object] break[object Object] if doublecheck:[object Object] desire.append(p)[object Object]#print(desire)[object Object]for _ in range(int(input())):[object Object] [object Object] n=int(input())[object Object] a=list(map(int,input().split( )))[object Object] print(*solve(n,a)) | def solve():[object Object] n = int(input())[object Object] lst = list(map(int,input().split()))[object Object] if sum(lst) <= n // 2:[object Object] print(n//2)[object Object] print("0 " * (n // 2))[object Object] else:[object Object] print(n//2 + (n // 2) % 2)[object Object] print("1 " * (n//2 + (n // 2) % 2))[object Object]for i in range(int(input())):[object Object] solve() | import sys[object Object]input = lambda: sys.stdin.readline().rstrip()[object Object][object Object]T = int(input())[object Object]for _ in range(T):[object Object] N = int(input())[object Object] A = [int(a) for a in input().split()][object Object] [object Object] if max(A) == min(A):[object Object] print(1)[object Object] print(*([1] * N))[object Object] elif N % 2 == 0:[object Object] print(2)[object Object] print(*([1, 2] * (N // 2)))[object Object] else:[object Object] for i in range(N):[object Object] if A[i-1] == A[i]:[object Object] print(2)[object Object] print(*(([1, 2] * N)[:i][::-1] + ([1, 2] * N)[:N-i]))[object Object] break[object Object] else:[object Object] print(3)[object Object] print(*([3] + [1, 2] * (N // 2)))[object Object][object Object] | import numpy as np[object Object][object Object]N=10**6+1[object Object]t=eval(input())[object Object]inp = ()[object Object][object Object]t1=ord('z')[object Object]#bag=[[0 for _ in xrange(t1)] for _ in xrange(N+1)][object Object]bag=np.zeros((N+1,t1),dtype=np.int)[object Object]#print bag[object Object]while t:[object Object] t-=1[object Object] inp=input().split()[object Object] t2=ord(inp[3]) - ord('a')[object Object] t3=int(inp[1])[object Object] t4=int(inp[2]) + 1[object Object] if inp[0]=="1":[object Object] #print "enter"[object Object] bag[t3][t2]+=int(inp[2])[object Object][object Object][object Object] if inp[0]=="2":[object Object] sum=0[object Object] for i in range(t3,t4):[object Object] sum+=bag[i][t2][object Object] print(sum)[object Object][object Object]#[object Object]# for j in range(ord('z')-ord('a')):[object Object]# for i in range(N+1):[object Object]# if bag[i][j]!=0:[object Object]# print bag[i][j] ,i,j[object Object][object Object][object Object][object Object] | # from math import log2[object Object]# N = 10000[object Object]# for i in range(1,N):[object Object]# # print(i)[object Object]# for m in range(i):[object Object]# if( (m^(m+1))==i ):[object Object]# print(i)[object Object]# print(m,m+1,bin(m)[2:])[object Object]# print()[object Object]# break[object Object]# # else:[object Object]# # print(-1)[object Object]# # print()[object Object]T = int(input())[object Object]ans = [][object Object][object Object]for _ in range(T):[object Object] N = int(input())[object Object][object Object] # x = log2(N+1)[object Object] if(N==1):[object Object] ans.append(2)[object Object] elif('0' not in bin(N)[2:]):[object Object] ans.append(N//2)[object Object] else:[object Object] ans.append(-1)[object Object][object Object]for i in ans:[object Object] print(i) | # from math import log2[object Object]# N = 10000[object Object]# for i in range(1,N):[object Object]# # print(i)[object Object]# for m in range(i):[object Object]# if( (m^(m+1))==i ):[object Object]# print(i)[object Object]# print(m,m+1,bin(m)[2:])[object Object]# print()[object Object]# break[object Object]# # else:[object Object]# # print(-1)[object Object]# # print()[object Object]T = int(input())[object Object]ans = [][object Object][object Object]for _ in range(T):[object Object] N = int(input())[object Object][object Object] # x = log2(N+1)[object Object] if(N==1):[object Object] ans.append(2)[object Object] elif('0' not in bin(N)[2:]):[object Object] ans.append(N//2)[object Object] else:[object Object] ans.append(-1)[object Object][object Object]for i in ans:[object Object] print(i) | # from math import log2[object Object]# N = 10000[object Object]# for i in range(1,N):[object Object]# # print(i)[object Object]# for m in range(i):[object Object]# if( (m^(m+1))==i ):[object Object]# print(i)[object Object]# print(m,m+1,bin(m)[2:])[object Object]# print()[object Object]# break[object Object]# # else:[object Object]# # print(-1)[object Object]# # print()[object Object]T = int(input())[object Object]ans = [][object Object][object Object]for _ in range(T):[object Object] N = int(input())[object Object][object Object] # x = log2(N+1)[object Object] if(N==1):[object Object] ans.append(2)[object Object] elif('0' not in bin(N)[2:]):[object Object] ans.append(N//2)[object Object] else:[object Object] ans.append(-1)[object Object][object Object]for i in ans:[object Object] print(i) |
| DevuLand is a very strange place. There are n villages in it. Some of the villages are occupied by dinosaurs while the remaining ones by villagers.[object Object] You are given the information of DevuLand [object Object] by an array D of size n. If D[i] is non-negative, it means that there are D[i] villagers in that village. [object Object] Otherwise, it means that are -D[i] [object Object] dinosaurs in that village.[object Object][object Object] It is also guaranteed that total number of villagers in DevuLand is equal to total number of dinosaurs.[object Object][object Object]Once dinosaurs got very hungry and started eating villagers. Frightened villagers gathered immediately and met their Sarpanch Deviji. Deviji, being a very daring and negotiable person, met to the head[object Object]of dinosaurs. Soon both parties called a truce. It was decided that the villagers will provide laddus to [object Object]the dinosaurs. So everyday, each villager will take exactly one laddu to one of the dinosaurs in such a way that no dinosaur remains hungry (note that this is possible because number of villagers is the same as the numbe... | # cook your dish here[object Object]for _ in range(int(input())):[object Object] n = int(input())[object Object] a = list(map(int, input().split()))[object Object] curr = 0[object Object] ans = 0[object Object] for x in a:[object Object] curr += x[object Object] ans += abs(curr)[object Object] print(ans) | from collections import deque
[object Object]T=int(input())
[object Object]def break_down(num):
[object Object] count=0
[object Object] while(len(num)!=1):
[object Object] temp=0
[object Object] for i in range(0,len(num)):
[object Object] temp=temp+int(num[i])
[object Object] num=str(temp)
[object Object] count=count+1
[object Object] return (int(num),count)
[object Object]def digit_sum(num):
[object Object] temp=0
[object Object] for i in range(0,len(num)):
[object Object] temp=temp+int(num[i])
[object Object] num=temp
[object Object] return (num)
[object Object]while(T):
[object Object] queue=deque()
[object Object] count_n=0
[object Object] count_d=0
[object Object] T=T-1
[object Object] N,d=[i for i in input().split()]
[object Object] n,count_n=break_down(N)
[object Object] D,count_D=break_down(d)
[object Object] dic={}
[object Object] if(D==1 or D==2 or D==4 or D==5 or D==7 or D==8):
[object Object] mini=1
[object Object] elif(D==3 or D==6):
[object Object] mini=min(digit_sum(str(n+3)),digit_sum(str(n+6)),digit_sum(str(n+9)))
[object Object] else:
[object Object] mini=n
[object Object] queue.append((int(N),0))
[object Object] ele=int(N)
[object Object] count=0
[object Object] while(len(queue)!=0):
[object Object] ele,count=queue.popleft()
[object Object] if(ele==mini):
[object Object] break
[object Object] else:
[object Object] if(len(str(ele))==1):
[object Object] temp1=ele+int(d)
[object Object] queue.append((temp1,count+1))... | # cook your dish here[object Object]test_cases = int(input())[object Object]for i in range(test_cases):[object Object] no_of_elements = int(input())[object Object] sequence = list(map(int, input().split()))[object Object] d1 = sequence[1] - sequence[0][object Object] d2 = sequence[2] - sequence[1][object Object] d3 = (sequence[3] - sequence[0])/3[object Object] d4 = (sequence[3] - sequence[1])/2[object Object] d5 = (sequence[2] - sequence[0])/2[object Object][object Object] if (d2 == d4):[object Object] d = d2[object Object][object Object] elif(d3 == d5):[object Object] d = d3[object Object][object Object] elif(d1 == d3):[object Object] d = d1[object Object][object Object] elif(d1 == d5):[object Object] d = d1[object Object][object Object] if (d == d1):[object Object] for i in range(no_of_elements):[object Object] sequence[i] = int(sequence[0] + i*d)[object Object] else:[object Object] for i in range(no_of_elements):[object Object] sequence[i] = int(sequence[-1] - ((no_of_elements - i - 1)*d))[object Object][object Object] for i in sequence:[object Object] print(i, end=" ")[object Object][object Object] print('\n')[object Object][object Object][object Object] | from collections import Counter[object Object]try:[object Object] for _ in range(int(input())):[object Object] n=int(input())[object Object] s=input()[object Object] d1=dict(Counter(s))[object Object] [object Object] u,d,r,l=0,0,0,0[object Object] if 'U' in d1:[object Object] u=d1['U'][object Object] else:[object Object] u=0[object Object] if 'D' in d1:[object Object] d=d1['D'][object Object] else:[object Object] d=0[object Object] if 'R' in d1:[object Object] r=d1['R'][object Object] else:[object Object] r=0[object Object] if 'L' in d1:[object Object] l=d1['L'][object Object] else:[object Object] l=0[object Object] x=0[object Object] y=0[object Object] if l==r:[object Object] x=0[object Object] elif l>r:[object Object] x=-(l-r)[object Object] elif r>l:[object Object] x=r-l[object Object] if u==d:[object Object] y=0[object Object] elif d>u:[object Object] y=-(d-u)[object Object] elif u>d:[object Object] y=u-d[object Object] # print(x,y)[object Object] if x==0 and y==0:[object Object] print(n)[object Object] continue[object Object] [object Object] print(n-(abs(x)+abs(y)))[object Object]except:[object Object] pass[object Object] | from bisect import bisect_left, insort_left[object Object]a = [][object Object]n = int(input())[object Object]for _ in range(n):[object Object] #print(a)[object Object] s, d = list(map(int, input().split()))[object Object] if len(a) == 0:[object Object] print(s, s+d - 1)[object Object] a.append((s, s + d - 1))[object Object] continue[object Object] p = bisect_left(a, (s, s + d - 1))[object Object] #print('p', p)[object Object] ok = True[object Object] if p > 0 and a[p-1][1] >= s:[object Object] ok = False[object Object] if p < len(a) and a[p][0] <= s + d - 1:[object Object] ok = False[object Object] if ok:[object Object] insort_left(a, (s, s + d - 1))[object Object] print(s, s + d - 1)[object Object] else:[object Object] ok = False[object Object] for i in range(len(a)):[object Object] if i == 0:[object Object] if a[0][0] > d:[object Object] print(1,d)[object Object] a = [(1, d)] + a[object Object] ok = True[object Object] break[object Object] else:[object Object] if a[i - 1][1] + d < a[i][0]:[object Object] print(a[i - 1][1] + 1, a[i - 1][1] + d)[object Object] insort_left(a, (a[i - 1][1] + 1, a[i - 1][1] + d))[object Object] ok = True[object Object] break[object Object] ... | import fractions[object Object]for t in range(int(input())):[object Object] h,u,d = list(map(int,input().split()))[object Object] g = fractions.gcd(u,d)[object Object] if (h%g!=0):[object Object] print(-1)[object Object] else:[object Object] m = 0[object Object] n = 0[object Object] while (True):[object Object] n = (float(m)*u-h)/d[object Object] if (n>0 and int(n) == n):[object Object] break[object Object] m+=1[object Object] print(int(m+n)) | import fractions[object Object]for t in range(int(input())):[object Object] h,u,d = list(map(int,input().split()))[object Object] g = fractions.gcd(u,d)[object Object] if (h%g!=0):[object Object] print(-1)[object Object] else:[object Object] m = 0[object Object] n = 0[object Object] while (True):[object Object] n = (float(m)*u-h)/d[object Object] if (n>0 and int(n) == n):[object Object] break[object Object] m+=1[object Object] print(int(m+n)) |
CachedMultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "mini_batch_size": 128,
5 "gather_across_devices": false,
6 "directions": [
7 "query_to_doc"
8 ],
9 "partition_mode": "joint",
10 "hardness_mode": null,
11 "hardness_strength": 0.0
12}query and positive| query | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| query | positive |
|---|---|
This gets the version of OpenALPR[object Object][object Object] :return: Version information | def get_version(self):[object Object] """[object Object] This gets the version of OpenALPR[object Object][object Object] :return: Version information[object Object] """[object Object][object Object] ptr = self._get_version_func(self.alpr_pointer)[object Object] version_number = ctypes.cast(ptr, ctypes.c_char_p).value[object Object] version_number = _convert_from_charp(version_number)[object Object] self._free_json_mem_func(ctypes.c_void_p(ptr))[object Object] return version_number |
Remove all unnecessary comments from a lexer or parser file | public String stripUnnecessaryComments(String javaContent, AntlrOptions options) {[object Object] if (!options.isOptimizeCodeQuality()) {[object Object] return javaContent;[object Object] }[object Object] javaContent = stripMachineDependentPaths(javaContent);[object Object] if (options.isStripAllComments()) {[object Object] javaContent = stripAllComments(javaContent);[object Object] }[object Object] return javaContent;[object Object] } |
Serialize reply to array or JSON.[object Object][object Object]@param {Object} packet[object Object]@param {String} packet.method "get", "search", "post", "put", "delete", "sub", "unsub".[object Object]@param {String} packet.resource[object Object]@param {String} packet.id[object Object]@param {*} packet.body[object Object]@param {Number} [packet.status][object Object]@param {Number|String} [packet.date][object Object]@param {Object} [packet.headers][object Object]@param {Boolean} [json] true to generate JSON instead of array.[object Object]@returns {Array|String|null} | function reply(packet, json) {[object Object] return _create(packet, packet.status || 500, (METHODS[packet.method] || '') + packet.resource, json);[object Object]} |
CachedMultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "mini_batch_size": 128,
5 "gather_across_devices": false,
6 "directions": [
7 "query_to_doc"
8 ],
9 "partition_mode": "joint",
10 "hardness_mode": null,
11 "hardness_strength": 0.0
12}eval_strategy: stepsper_device_train_batch_size: 1024per_device_eval_batch_size: 1024num_train_epochs: 1warmup_steps: 0.05bf16: Truedataloader_num_workers: 4load_best_model_at_end: Truepush_to_hub: Truehub_model_id: modernbert-code-v4-hard-negativesbatch_sampler: no_duplicatesdo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 1024per_device_eval_batch_size: 1024gradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0.05log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Falsedataloader_num_workers: 4dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Trueignore_data_skip: Falsefsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Trueresume_from_checkpoint: Nonehub_model_id: modernbert-code-v4-hard-negativeshub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | eval_cosine_ndcg@10 |
|---|---|---|---|---|
| 0.0738 | 20 | 0.9880 | - | - |
| 0.1476 | 40 | 0.9529 | 0.3465 | 0.9286 |
| 0.2214 | 60 | 0.9726 | - | - |
| 0.2952 | 80 | 0.9299 | 0.3351 | 0.9296 |
| 0.3690 | 100 | 0.9130 | - | - |
| 0.4428 | 120 | 0.9187 | 0.3253 | 0.9325 |
| 0.5166 | 140 | 0.8940 | - | - |
| 0.5904 | 160 | 0.9037 | 0.3186 | 0.9354 |
| 0.6642 | 180 | 0.8951 | - | - |
| 0.738 | 200 | 0.8816 | 0.3121 | 0.9361 |
| 0.8118 | 220 | 0.8753 | - | - |
| 0.8856 | 240 | 0.8649 | 0.3106 | 0.9359 |
| 0.9594 | 260 | 0.8575 | - | - |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{gao2021scaling,
2 title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
3 author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
4 year={2021},
5 eprint={2101.06983},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG}
8}