<jupyter_start><jupyter_text>Annealing by Toshiba SBM<jupyter_code>import subprocess
import joblib
ip="ip address for server"
cmd=f"""
curl -i -H "Content-Type: application/octet-stream" -X POST "{ip}:8000/solver/ising?steps=0&loops=10" --data-binary "@test.mm"
"""
cmd=cmd.replace("\n","")
#test job
%time res=subprocess.check_output(cmd, shell=True)
res<jupyter_output><empty_output><jupyter_text>Make qubo for SBM<jupyter_code>#make sparse dict from array-type qubo
original_qubo=joblib.load("../data/rbm_J.bin")

scale=10**5
dim=original_qubo.shape[0]
sparse_dict={}
for i in range(dim):
    for j in range(dim):
        val=-original_qubo[i][j]*scale
        if val!=0:
            sparse_dict[f"{j+1} {i+1}"]=int(val)
#save as mm file
num_non_zero_params=len(sparse_dict.keys())

output=f"""%%MatrixMarket matrix coordinate real symmetric
{dim} {dim} {num_non_zero_params}
"""

#output
for k,v in sparse_dict.items():
    output+=f"{k} {v}\n"
    
with open("qubo.mm","w") as f:
    f.write(output[:-1])<jupyter_output><empty_output><jupyter_text>Annealing by SBM<jupyter_code>timeout=60
cmd=f"""
curl -i -H "Content-Type: application/octet-stream" -X POST "{ip}:8000/solver/ising?steps=0&loops=10&timeout={timeout}" --data-binary "@qubo.mm"
"""

cmd=cmd.replace("\n","")
#%time res=subprocess.check_output(cmd, shell=True)
print(res)<jupyter_output>b'HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 4136\r\nETag: W/"1028-MwZccDhIkqhiMFV4+Jh9KwaZ5qo"\r\nDate: Thu, 19 Aug 2021 08:28:46 GMT\r\nProxy-Connection: Keep-Alive\r\nConnection: Keep-Alive\r\n\r\n{"id":"r2814050749","time":60.07,"wait":0,"runs":2240,"steps":8001,"C":0.0000066,"dt":1,"message":"timeout","value":-3961787,"result":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0[...]
{'fraction_non_alphanumeric': 0.27149512918254975, 'fraction_numerical': 0.16730199068191445, 'mean_word_length': 8.485943775100402, 'pattern_counts': {'":': 10, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '501922', 'license': 'MIT', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1323, 'n_words': 113, 'path': '3_2_anneal_comparison/toshiba_sbm/SBM.ipynb', 'repo_name': 'KanHatakeyama/anneal_project2', 'size': '2361'}