Skip to content

Instantly share code, notes, and snippets.

View seyyedaliayati's full-sized avatar
💭
Coding...

Seyyed Ali Ayati seyyedaliayati

💭
Coding...
View GitHub Profile
@seyyedaliayati
seyyedaliayati / compare.py
Last active June 1, 2023 19:26
Compare two models in huggingface format
from transformers import AutoModel
import torch
# Load the models
model1 = AutoModel.from_pretrained('bigcode/starcoderbase') # replace with your model names
model2 = AutoModel.from_pretrained('bigcode/starcoder')
# Retrieve the state dictionaries
state_dict1 = model1.state_dict()
state_dict2 = model2.state_dict()
@seyyedaliayati
seyyedaliayati / aptos_move_include_call_diagrams.patch
Created April 13, 2023 18:16
Enabling --include-call-diagrams flag in `aptos move` command.
diff --git a/aptos-move/framework/src/aptos.rs b/aptos-move/framework/src/aptos.rs
index 845756d18f..bc43243adb 100644
--- a/aptos-move/framework/src/aptos.rs
+++ b/aptos-move/framework/src/aptos.rs
@@ -110,6 +110,7 @@ impl ReleaseTarget {
include_impl: true,
include_specs: true,
specs_inlined: false,
+ include_call_diagrams: false,
include_dep_diagram: false,
pub struct BoogieOptions {
/// Path to the boogie executable.
pub boogie_exe: String,
/// Use experimental boogie exe found via env var EXP_BOOGIE_EXE.
pub use_exp_boogie: bool,
/// Path to the z3 executable.
pub z3_exe: String,
/// Whether to use cvc5.
pub use_cvc5: bool,
/// Path to the cvc5 executable.
pub struct ProverOptions {
/// Whether to only generate backend code.
pub generate_only: bool,
/// Whether to generate stubs for native functions.
pub native_stubs: bool,
/// Whether to minimize execution traces in errors.
pub minimize_execution_trace: bool,
/// Whether to omit debug information in generated model.
pub omit_model_debug: bool,
/// Whether output for e.g. diagnosis shall be stable/redacted so it can be used in test
Option Type Default Description
generate_only bool false Whether to only generate backend code.
native_stubs bool false Whether to generate stubs for native functions.
minimize_execution_trace bool true Whether to minimize execution traces in errors.
omit_model_debug bool false Whether to omit debug information in generated model.
stable_test_output bool false Whether output for e.g. diagnosis shall be stable/redacted so it can be used in test output.
verify_scope enum All Scope of what functions to verify.
resource_wellformed_axiom bool false [deprecated] Whether to emit global axiom that resources are well-formed.
@seyyedaliayati
seyyedaliayati / pthread-race.cc
Created September 5, 2021 05:02
Simple pthread race condition in C++
#include <pthread.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int x = 0;
void *PrintHello(void *threadid) {
long tid;
@seyyedaliayati
seyyedaliayati / simple_race_condition_example.c
Created September 4, 2021 06:21
Simple Race Condition Example
#include <pthread.h>
int global;
pthread_mutex_t mutex;
int global_locked;
void *foo(void *a) {
global++;
pthread_mutex_lock(&mutex);
global_locked++;