This file contains hidden or 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
| from typing import Any | |
| import torch | |
| from datasets import Dataset, DatasetDict, load_dataset | |
| from transformers import AutoModelForSequenceClassification, AutoTokenizer | |
| # --- 1. CONFIGURATION CONSTANTS --- | |
| MODEL_NAME = "bert-base-uncased" # The Hugging Face model to use | |
| MAX_LENGTH = 128 # Max length for tokenization | |
| BATCH_SIZE = 16 # Batch size for training |
This file contains hidden or 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
| import torch | |
| from torchvision import transforms | |
| from PIL import Image | |
| import torch.nn.functional as F | |
| # Load images | |
| image1 = Image.open("images/image1.jpg").convert("RGB") | |
| image2 = Image.open("images/image1.jpg").convert("RGB") # Comparing to itself | |
| # Transform to tensors, scale to 0-255 for SSIM |
This file contains hidden or 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
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" | |
| "os/exec" | |
| "path/filepath" |
This file contains hidden or 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
| package main | |
| import ( | |
| "bytes" | |
| "os" | |
| "github.com/rs/zerolog/log" | |
| "golang.org/x/crypto/ssh" | |
| ) |
This file contains hidden or 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
| public class DeadlockExample { | |
| public static void main(String[] args) { | |
| Object lock1 = new Object(); | |
| Object lock2 = new Object(); | |
| Thread thread1 = new Thread(() -> { | |
| synchronized (lock1) { | |
| System.out.println("Thread 1: Acquired lock1"); | |
| try { | |
| Thread.sleep(1000); |
This file contains hidden or 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
| package com.tutorial.hello; | |
| import com.tutorial.hello.HelloOuterClass.Hello; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; |
This file contains hidden or 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
| from flask import Flask, Response, current_app, jsonify, make_response | |
| from flask.views import MethodView | |
| def create_app() -> Flask: | |
| """Create application context.""" | |
| created_app = Flask(__name__) | |
| return created_app | |
This file contains hidden or 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
| from datetime import datetime, timezone | |
| from typing import Any, Optional, Sequence, Type | |
| from sqlalchemy import ( | |
| DateTime, | |
| Dialect, | |
| ForeignKey, | |
| Result, | |
| Row, | |
| String, |
This file contains hidden or 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
| from queue import Queue | |
| from threading import Thread | |
| from time import sleep | |
| # https://docs.python.org/3/library/queue.html | |
| # https://stackoverflow.com/questions/27200674/python-queue-join | |
| # https://stackoverflow.com/questions/7445742/runtimeerror-thread-init-not-called-when-subclassing-threading-thread | |
| _TASK_QUEUE = Queue() | |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| type Sudoku = [9][9]int | |
| func main() { | |
| unsolved := Sudoku{ |
NewerOlder