Skip to content

Instantly share code, notes, and snippets.

View vichShir's full-sized avatar

Victor Shirasuna vichShir

  • São Paulo
View GitHub Profile
@vichShir
vichShir / setup_lmql_environment.md
Last active April 16, 2023 20:08
Experimental setup using Hugging Face models for LMQL

Experimental Setup for LMQL with Hugging Face

We will set up an LMQL environment with Hugging Face models using Docker.

LMQL is a query language for large language models (LLMs). It facilitates LLM interaction by combining the benefits of natural language prompting with the expressiveness of Python. With only a few lines of LMQL code, users can express advanced, multi-part and tool-augmented LM queries, which then are optimized by the LMQL runtime to run efficiently as part of the LM decoding loop.

Prerequisites

Docker

"The no-GPU version was tested to work on Ubuntu 22.04 and macOS 13.2 Ventura or Windows 10 via WSL2."

Otherwise, you may have to run an Ubuntu image with Docker:

@vichShir
vichShir / bigrams.py
Last active August 28, 2022 22:04
Bigrams in NLP with Gensim
from gensim.models.phrases import Phrases, Phraser
documents = ["o prefeito de nova iorque esteve aqui!",
"machine learning pode ser útil às vezes...",
"nova iorque é uma cidade muito grande",
"o que é machine learning?",
"machine learning é fascinante!"]
# Split
sentence_stream = [doc.split(" ") for doc in documents]
@vichShir
vichShir / gensim<4.0.0.py
Last active August 28, 2022 22:01
How to retrain a Word2Vec model in Gensim
from gensim.models.word2vec import Word2Vec
from gensim.models import KeyedVectors
pret_model_path = 'cbow_s50.txt'
my_corpus = [['machine_learning', 'gensim'], ['big_data', 'hadoop']]
# New model
w2v_model = Word2Vec(size=50, min_count=1, workers=1, sg=0, seed=1)
w2v_model.build_vocab(my_corpus)
w2v_model.vocabulary.min_count = 0
@vichShir
vichShir / download_link.txt
Last active September 14, 2022 12:59
Download large files from Google Drive shareable link using Jupyter
@vichShir
vichShir / README.md
Last active December 20, 2024 13:46
Execute SQL Server Stored Procedures in PHP

How to execute SQL Server Stored Procedures in PHP

1. Connect to SQL Server (PDO)

$conn = new PDO("sqlsrv:Server=localhost,1433;Database=database_name", "username", "your_strong_password");

2. Prepare the Stored Procedure Command

$sth = $conn-&gt;prepare("SET NOCOUNT ON; EXEC stored_procedure_name ?, ?, ?;");