Instructions to use npc-worldwide/TinyTimV1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use npc-worldwide/TinyTimV1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="npc-worldwide/TinyTimV1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("npc-worldwide/TinyTimV1") model = AutoModelForCausalLM.from_pretrained("npc-worldwide/TinyTimV1") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use npc-worldwide/TinyTimV1 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="npc-worldwide/TinyTimV1", filename="ggml-model-f16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use npc-worldwide/TinyTimV1 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf npc-worldwide/TinyTimV1:F16 # Run inference directly in the terminal: llama-cli -hf npc-worldwide/TinyTimV1:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf npc-worldwide/TinyTimV1:F16 # Run inference directly in the terminal: llama-cli -hf npc-worldwide/TinyTimV1:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf npc-worldwide/TinyTimV1:F16 # Run inference directly in the terminal: ./llama-cli -hf npc-worldwide/TinyTimV1:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf npc-worldwide/TinyTimV1:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf npc-worldwide/TinyTimV1:F16
Use Docker
docker model run hf.co/npc-worldwide/TinyTimV1:F16
- LM Studio
- Jan
- vLLM
How to use npc-worldwide/TinyTimV1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "npc-worldwide/TinyTimV1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "npc-worldwide/TinyTimV1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/npc-worldwide/TinyTimV1:F16
- SGLang
How to use npc-worldwide/TinyTimV1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "npc-worldwide/TinyTimV1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "npc-worldwide/TinyTimV1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "npc-worldwide/TinyTimV1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "npc-worldwide/TinyTimV1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use npc-worldwide/TinyTimV1 with Ollama:
ollama run hf.co/npc-worldwide/TinyTimV1:F16
- Unsloth Studio new
How to use npc-worldwide/TinyTimV1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for npc-worldwide/TinyTimV1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for npc-worldwide/TinyTimV1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for npc-worldwide/TinyTimV1 to start chatting
- Docker Model Runner
How to use npc-worldwide/TinyTimV1 with Docker Model Runner:
docker model run hf.co/npc-worldwide/TinyTimV1:F16
- Lemonade
How to use npc-worldwide/TinyTimV1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull npc-worldwide/TinyTimV1:F16
Run and chat with the model
lemonade run user.TinyTimV1-F16
List all available models
lemonade list
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,9 +1,67 @@
|
|
|
|
|
| 1 |
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
-
TinyTim is a version of TinyLlama that has been finetuned on text from James Joyce's Finnegan's Wake.
|
| 9 |
-
Hope other Joyce fans find it useful or entertaining!
|
|
|
|
| 1 |
+
# TinyTimV1: Fine-tuning TinyLlama on Finnegan's Wake
|
| 2 |
|
| 3 |
+
A project exploring the fine-tuning of TinyLlama-1.1B on James Joyce's *Finnegan's Wake* to generate Joyce-inspired text.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
This project fine-tunes the TinyLlama-1.1B-Chat model on the complete text of James Joyce's *Finnegan's Wake*, creating a language model capable of generating text in Joyce's distinctive experimental style. The model learns to replicate the complex wordplay, neologisms, and stream-of-consciousness narrative techniques characteristic of Joyce's final work.
|
| 8 |
+
|
| 9 |
+
## Files
|
| 10 |
+
|
| 11 |
+
- `process_wake.py` - Preprocesses the raw text, removes page numbers, and splits into manageable chunks
|
| 12 |
+
- `fine_tune_joyce.py` - Main training script using HuggingFace Transformers
|
| 13 |
+
- `text_gen.py` - Text generation script for the fine-tuned model
|
| 14 |
+
- `finn_wake.txt` - Complete text of Finnegan's Wake (1.51 MB)
|
| 15 |
+
- `finn_wake.csv` - Processed dataset in CSV format
|
| 16 |
+
- `finn_wake_dataset/` - Tokenized dataset directory
|
| 17 |
+
|
| 18 |
+
## Usage
|
| 19 |
+
|
| 20 |
+
### 1. Data Preprocessing
|
| 21 |
+
```bash
|
| 22 |
+
python process_wake.py
|
| 23 |
+
```
|
| 24 |
+
This removes page numbers and splits the text into 100-word chunks for training.
|
| 25 |
+
2. Fine-tuning
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
python fine_tune_joyce.py
|
| 29 |
+
```
|
| 30 |
+
Fine-tunes TinyLlama on the processed dataset for 3 epochs with CPU training.
|
| 31 |
+
3. Text Generation
|
| 32 |
+
```bash
|
| 33 |
+
python text_gen.py
|
| 34 |
+
```
|
| 35 |
+
Generates Joyce-inspired text using the fine-tuned model.
|
| 36 |
+
|
| 37 |
+
Model Details
|
| 38 |
+
|
| 39 |
+
Base Model: TinyLlama-1.1B-Chat-v1.0
|
| 40 |
+
Training Data: Finnegan's Wake (~1.5MB text)
|
| 41 |
+
Training Parameters:
|
| 42 |
+
|
| 43 |
+
3 epochs
|
| 44 |
+
Batch size: 1
|
| 45 |
+
Max sequence length: 128 tokens
|
| 46 |
+
Temperature: 0.7
|
| 47 |
+
Top-k: 50, Top-p: 0.95
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
Example Output
|
| 52 |
+
Input: "ae left to go to ireland and found a fairy"
|
| 53 |
+
The model generates text continuing in Joyce's experimental style with invented words, Irish references, and complex linguistic play.
|
| 54 |
+
Requirements
|
| 55 |
+
transformers
|
| 56 |
+
datasets
|
| 57 |
+
pandas
|
| 58 |
+
torch
|
| 59 |
+
Installation
|
| 60 |
+
bashpip install transformers datasets pandas torch
|
| 61 |
+
Notes
|
| 62 |
+
|
| 63 |
+
Training was performed on CPU due to resource constraints
|
| 64 |
+
Model checkpoints saved every 500 steps
|
| 65 |
+
Resume training supported from checkpoints
|
| 66 |
|
| 67 |
|
|
|
|
|
|