Skip to content

Instantly share code, notes, and snippets.

View tmabraham's full-sized avatar
💻
Researching deep learning

Tanishq Abraham tmabraham

💻
Researching deep learning
View GitHub Profile
@tmabraham
tmabraham / ollama-api-public.md
Created October 28, 2024 01:14
Making Ollama API Publicly Accessible

Making Ollama API Publicly Accessible

This guide shows how to configure Ollama to accept connections from any IP address instead of just localhost.

1. Check Current Status

Check if Ollama is currently listening only on localhost:

ss -tulpn | grep 11434

If you see 127.0.0.1:11434, it's only accessible locally.

Model Information

The Meta Llama 3.1 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction tuned generative models in 8B, 70B and 405B sizes (text in/text out). The Llama 3.1 instruction tuned text only models (8B, 70B, 405B) are optimized for multilingual dialogue use cases and outperform many of the available open source and closed chat models on common industry benchmarks.

Model developer: Meta

Model Architecture: Llama 3.1 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.

@tmabraham
tmabraham / consistency-miniai-model-comparison.ipynb
Created April 10, 2023 09:42
comparing consistency model performance of miniai model with batchnorm or groupnorm
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from timm import create_model
from fastai.vision.learner import _add_norm
class TimmBody(nn.Module):
def __init__(self, arch:str, pretrained:bool=True, cut=None, n_in:int=3):
super().__init__()
model = create_model(arch, pretrained=pretrained, num_classes=0, in_chans=n_in)
if isinstance(cut, int): self.model = nn.Sequential(*list(model.children())[:cut])
elif callable(cut): self.model = cut(model)
elif cut is None: self.model = model

For each function/class please check the following:

  • Is every argument on a new line, unless it's a self or cls keyword?
  • Is it formatted like this? (Pay attention to the location of the arguments on the newline and the closing parentheses):
def __init__(self, 
    a, 
    b, 
    c
)
import gradio as gr
import fastai
import skimage
learn = load_learner('export.pkl')
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn.predict(img)
@tmabraham
tmabraham / tpu_distributed_fastai.py
Last active April 25, 2020 03:57
Using fastai on the TPU (draft 1)
import warnings
warnings.filterwarnings('ignore')
import torch_xla
import torch_xla.distributed.data_parallel as dp
import torch_xla.utils.utils as xu
import torch_xla.core.xla_model as xm
import torch_xla.distributed.parallel_loader as pl
import torch_xla.distributed.xla_multiprocessing as xmp
import torch