Skip to content

Instantly share code, notes, and snippets.

View freedomtowin's full-sized avatar

Rohan Kotwani freedomtowin

View GitHub Profile
@freedomtowin
freedomtowin / intro-zero_dioxus-notes-analysis.rs
Created February 25, 2025 22:19
Example of creating a Gist using Python
let _some_obj = self.some_obj.clone();
tokio::task::spawn(async move {
process(_some_obj)
});
@freedomtowin
freedomtowin / intro-zero_dioxus-notes-analysis.rs
Created February 25, 2025 22:19
Example of creating a Gist using Python
#[derive(Debug, Clone)]
struct SomethingBig {
name: String,
children: Vec<SomethingBig>,
}
impl SomethingBig {
fn modify(&mut self) {
self.name = "modified".to_string();
}
@freedomtowin
freedomtowin / intro-zero_dioxus-notes-analysis.rs
Created February 25, 2025 22:19
Example of creating a Gist using Python
let result: Result<f64, String> = divide_function(100.23, 73.98);
match result {
Ok(x) => println!("Result: {}", x),
Err(e) => println!("Error: {}", e),
}
@freedomtowin
freedomtowin / intro-zero_dioxus-notes-analysis.rs
Created February 25, 2025 22:19
Example of creating a Gist using Python
let result: Option<String> = Some("hello".to_string);
match result {
Some(x) => println!("Result: {}", x),
None => println!("Error"),
}
@freedomtowin
freedomtowin / intro-zero_hugging-face-course-training.txt
Created January 9, 2025 02:46
Example of creating a Gist using Python
| Epoch | Training Loss | Validation Loss | Accuracy | F1 |
|-------|---------------|-----------------|----------|----------|
| 1 | No log | 0.383960 | 0.830882 | 0.883249 |
| 2 | 0.507400 | 0.558366 | 0.845588 | 0.891192 |
| 3 | 0.259800 | 0.712663 | 0.865196 | 0.905009 |
TrainOutput(global_step=1377, training_loss=0.3134817651154429, metrics={'train_runtime': 241.2671, 'train_samples_per_second': 45.609, 'train_steps_per_second': 5.707, 'total_flos': 405114969714960.0, 'train_loss': 0.3134817651154429, 'epoch': 3.0})
@freedomtowin
freedomtowin / intro-zero_hugging-face-course-training.py
Created January 9, 2025 02:46
Example of creating a Gist using Python
import numpy as np
from transformers import TrainingArguments
from transformers import Trainer
import evaluate
metric = evaluate.load("glue", "mrpc")
def compute_metrics(eval_preds):
logits, labels = eval_preds
predictions = np.argmax(logits, axis=-1)
@freedomtowin
freedomtowin / intro-zero_hugging-face-course-training.txt
Created January 9, 2025 02:46
Example of creating a Gist using Python
stateDiagram-v2
Metrics --> Trainer
Hyperparameters --> Trainer
Model --> Trainer
Metrics --> Trainer
TrainingDataset --> Trainer
ValidationDataset --> Trainer
TestDataset --> Trainer
Tokenizer --> Trainer
DataCollator --> Trainer
@freedomtowin
freedomtowin / intro-zero_hugging-face-course-training.txt
Created January 9, 2025 02:46
Example of creating a Gist using Python
Epoch 1/3
Training Loss: 0.5249
Validation Loss: 0.4029
Evaluation Metrics: {'accuracy': 0.8284313725490197, 'f1': 0.8741007194244604}
Epoch 2/3
Training Loss: 0.2626
Validation Loss: 0.3794
Evaluation Metrics: {'accuracy': 0.8529411764705882, 'f1': 0.8979591836734694}
Epoch 3/3
Training Loss: 0.0937
@freedomtowin
freedomtowin / intro-zero_hugging-face-course-training.py
Created January 9, 2025 02:46
Example of creating a Gist using Python
from transformers import AutoModelForSequenceClassification
import torch
from transformers import AdamW
from transformers import get_scheduler
from tqdm.auto import tqdm
import evaluate
# Initialize metric and model
metric = evaluate.load("glue", "mrpc")
model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
@freedomtowin
freedomtowin / intro-zero_hugging-face-course-training.txt
Created January 9, 2025 02:46
Example of creating a Gist using Python
torch.Size([16, 80])
torch.Size([16, 72])
torch.Size([16, 84])
torch.Size([16, 86])
torch.Size([16, 75])