This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_data_to_examples(train, test, DATA_COLUMN, LABEL_COLUMN): | |
train_InputExamples = train.apply(lambda x: InputExample(guid=None, # Globally unique ID for bookkeeping, unused in this case | |
text_a = x[DATA_COLUMN], | |
text_b = None, | |
label = x[LABEL_COLUMN]), axis = 1) | |
validation_InputExamples = test.apply(lambda x: InputExample(guid=None, # Globally unique ID for bookkeeping, unused in this case | |
text_a = x[DATA_COLUMN], | |
text_b = None, | |
label = x[LABEL_COLUMN]), axis = 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
optimizer = tf.keras.optimizers.Adam(learning_rate=3e-5, epsilon=1e-08, clipnorm=1.0) | |
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True) | |
metric = tf.keras.metrics.SparseCategoricalAccuracy('accuracy') | |
model.compile(optimizer=optimizer, loss=loss, metrics=[metric]) | |
model.fit(train_data, epochs=7, validation_data=validation_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tf_batch = tokenizer(pred_sentences, max_length=128, padding=True, truncation=True, return_tensors='tf') | |
tf_outputs = model(tf_batch) | |
tf_predictions = tf.nn.softmax(tf_outputs[0], axis=-1) | |
labels = ['Negative','Positive'] | |
label = tf.argmax(tf_predictions, axis=1) | |
label = label.numpy() | |
for i in range(len(pred_sentences)): | |
print(pred_sentences[i], ": ", labels[label[i]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requirements: install HuggingFace Transformer library beforehand | |
# pip install transformers | |
from transformers import BertTokenizer, TFBertForSequenceClassification | |
from transformers import InputExample, InputFeatures | |
model = TFBertForSequenceClassification.from_pretrained("bert-base-uncased") | |
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# agent taking a step at each time step | |
def agent_step(self, reward, state): | |
# reward (r.t) is the reward obtained from the previous step, state (s.t+1) is the state for the current step | |
act_values = self.model.predict(state)[0] # an array of action values of current time step | |
action = self.agent_take_action(act_values) # action chosen in current time step | |
# Perform an update to the neural network model based on previous step | |
target = reward + self.discount * act_values[action] | |
target_f = self.model.predict(self.prev_state) # action values of previous step | |
target_f[0][self.prev_action] = target # update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<v-app> | |
<v-card> | |
Some random content | |
</v-card> | |
</v-app> | |
</template> | |
<script language="javascript" type="text/javascript" src="jslibs/web3.min.js"></script> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.7.0; | |
contract Bank { | |
mapping(address => uint256) balance; | |
address[] public customers; | |
event Deposit(address customer, string message); | |
event Withdrawal(address customer); | |
function deposit(string memory message) public payable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HDWalletProvider = require('@truffle/hdwallet-provider'); | |
const fs = require('fs'); | |
const mnemonic = fs.readFileSync(".secret").toString().trim(); | |
module.exports = { | |
networks: { | |
development: { | |
host: "127.0.0.1", // Localhost (default: none) | |
port: 7545, // Standard Ethereum port (default: none) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hey, I'm eerkaijun-47535524 and I have contributed to the nocturne-v1 MPC Phase2 Trusted Setup ceremony. | |
The following are my contribution signatures: | |
Circuit # 1 (canonaddrsigcheck) | |
Contributor # 27 | |
Contribution Hash: a826bf54 5f7ecfaa 85581345 4e123d71 | |
b3ddef0f e8d82308 20775e92 830dfbf8 | |
9374fdae 55f559dc 580ba201 36dc7abe | |
54af3759 cb3d3ae3 4f07dcb5 0e3bd38a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.13; | |
import "forge-ctf/CTFSolver.sol"; | |
import "../src/Split.sol"; | |
import "../src/Challenge.sol"; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
contract Solution is CTFSolver { |