Skip to content

Instantly share code, notes, and snippets.

View tengomucho's full-sized avatar
🏄

Alvaro Moran tengomucho

🏄
  • Hugging Face
  • Toulouse, France
  • 08:20 (UTC +02:00)
View GitHub Profile
@tengomucho
tengomucho / gemma_compiled_test.py
Created March 21, 2024 15:22
Test showing an error when compiling model and using direct assignment
from transformers import AutoModelForCausalLM, AutoTokenizer, StaticCache
import torch
import os
import torch_xla.core.xla_model as xm
from datetime import datetime
os.environ["PJRT_DEVICE"] = "TPU"
def dprint(*args, **kwargs):
@tengomucho
tengomucho / static_cache_test.py
Last active March 8, 2024 14:19
🤗 transformers with google/gemma-2b on TPU test
#!/usr/bin/python
# Mostly inspired from:
# https://twitter.com/reach_vb/status/1759716375033938291
from transformers import AutoModelForCausalLM, AutoTokenizer, StaticCache
import torch
import time
import datetime
@tengomucho
tengomucho / testoprof.c
Last active August 29, 2015 14:05
A sample to use to test profilers (for example oprofile). To be compiled like this: gcc -o testoprof -lpthread testoprof.c
/* I know this is no good, but I want to use strfry */
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#define SIZE 500000
#define NTHREADS 4