Ping Zhou
Ping Zhou
Hi, I tried writing a simplest circuit using the "qsim" format: ``` 1 0 x 0 1 h 0 ``` It only contains one qubit, using one X gate and...
A relative comment: The qsim format is deprecated. Is it possible to import circuit from Cirq's JSON format?
Another related question: How do I add measurements to the circuit, e.g. something like what I did this notebook: https://github.com/zhoupingjay/quantum/blob/main/2-bit-Deutsch-Problem.ipynb ``` circuit.append([cirq.measure(q0), cirq.measure(q1)], strategy=cirq.InsertStrategy.NEW_THEN_INLINE) ```
嗯……我想是不是可以这样理解: 在phase-1遇到更高的ballot number,但是其数量并没有影响我拿到quorum(比如我问了所有5个节点,1个有更高的ballot number,其余4个都比我低)。这种情况说明可能有其他的proposer用更高的ballot number尝试过phase-1,但失败了(否则他就会拿到多数派的promise,从而我不可能拿到quorum)。这种情况下,我可以有两种选择: (1) 一是严格按照经典paxos协议,认为我的这次phase-1失败了,退出并用更高的ballot number重新尝试。 (2) 二是既然我能够拿到quorum,说明其他proposer的phase-1没成功(即使它用了更高的ballot number),这时我继续往下执行phase-2提交,不会造成不一致的情况。 但是这样的话,那些已经promise过更高ballot number的acceptor,要怎么处理我发来的Accept消息呢?对这些acceptor来说,既然已经promise了更高的ballot number,就应该拒绝这个Accept请求(参见这[里的slide-31](https://blog.openacid.com/algo/paxos/))。于是这些promise过更高ballot number的acceptor都会拒绝我的Accept请求。这不会影响正确性,因为这些拒绝我Accept请求的acceptor是少数(否则我不会进入phase-2)。所以这些其实是无效的promise。这种情况也不会永远持续下去,因为ballot number是单调增加的,当协议运行到采用更高ballot number时,这些无效的promise就会被override掉。 总结一下,选项 (1) 按照经典paxos直接失败退出phase-1更加简单,但代价就是需要重新做phase-1,选项 (2) 可以避免一次重复的phase-1,但逻辑上这两者是等价的,(2) 相当于把 (1) 后面的重试phase-1合并进来了。
More analysis: I think the root cause is here: ```python def generate(self, idx, max_new_tokens): # idx is (B, T) array of indices in the current context for _ in range(max_new_tokens):...