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
################################################################################################### | |
# # | |
# RAG(Retrieval Augmented Generation) example # | |
# <[email protected]> # | |
# # | |
# Used: # | |
# Application : Streamlit # | |
# LLM Framework : LangChain # | |
# LLM Related : llama-2 7B, GPT4All(embedding model) # | |
# # |
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 tensorflow as tf | |
import pathlib | |
# Load the MobileNet tf.keras model | |
model = tf.keras.applications.MobileNetV2(weights="imagenet", input_shape=(224,224,3)) | |
# Convert the model | |
converter = tf.lite.TFLiteConverter.from_keras_model(model) | |
tflite_model = converter.convert() |
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 tensorflow as tf | |
# Store data for x and y | |
x = [-1, 0, 1, 2, 3, 4] | |
y = [-3,-1, 1, 3, 5, 7] | |
# Create a simple Keras model | |
model = tf.keras.models.Sequential( | |
[tf.keras.layers.Dense(units=1, input_shape=[1])]) | |
model.compile(optimizer='sgd', loss='mean_squared_error') | |
model.fit(x, y, epochs=500) |
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
class Solution { | |
public: | |
int minTimeToVisitAllPoints(vector<vector<int>>& points) { | |
int time = 0; | |
for(int i = 1; i < points.size() ; i++) | |
{ | |
int x, y, m; | |
x = abs(points[i-1][0] - points[i][0]); | |
y = abs(points[i-1][1] - points[i][1]); | |
m = min(x, y); |
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
#include <iostream> | |
#include <cstdio> | |
#include <helper_cuda.h> | |
#include <helper_string.h> | |
#define MAX_DEPTH 16 | |
#define SELECTION_SORT 32 | |
__device__ void selection_sort(unsigned int *data, int left, int right) | |
{ |
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
#include <iostream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <helper_cuda.h> | |
#include <helper_string.h> | |
__device__ int g_uids = 0; | |
__device__ void print_info(int depth, int thread, int uid, int parent_uid) | |
{ |
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
#include <iostream> | |
#include <cuda.h> | |
#include <cuda_runtime.h> | |
__global__ void saxpy(int n, float a, float *__restrict__ x, float *__restrict__ y) | |
{ | |
int i = blockIdx.x * blockDim.x + threadIdx.x; | |
if( i < n ) | |
y[i] = a * x[i] + y[i]; | |
} |
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
#include <cublas.h> | |
int main() | |
{ | |
int N = 1 << 16; | |
int size = N * sizeof(float); | |
float *h_x = (float*)malloc(size); | |
float *h_y = (float*)malloc(size); | |
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
__global__ void saxpy(int n, float a, float *__restrict__ x, float *__restrict__ y) | |
{ | |
int i = blockIdx.x * blockDim.x + threadIdx.x; | |
if( i < n ) | |
y[i] = a * x[i] + y[i]; | |
} | |
int main() | |
{ | |
int N = 1 << 16; |
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
#include <opencv2/opencv.hpp> | |
#include <iostream> | |
#include <stdio.h> | |
using namespace std; | |
using namespace cv; | |
int main(int argv, char** argc) | |
{ | |
Mat frame; |
NewerOlder