Instructions to use lilmeaty/text-gen-example-one-layer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lilmeaty/text-gen-example-one-layer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lilmeaty/text-gen-example-one-layer")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("lilmeaty/text-gen-example-one-layer") model = AutoModelForCausalLM.from_pretrained("lilmeaty/text-gen-example-one-layer") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use lilmeaty/text-gen-example-one-layer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lilmeaty/text-gen-example-one-layer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lilmeaty/text-gen-example-one-layer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lilmeaty/text-gen-example-one-layer
- SGLang
How to use lilmeaty/text-gen-example-one-layer 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 "lilmeaty/text-gen-example-one-layer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lilmeaty/text-gen-example-one-layer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "lilmeaty/text-gen-example-one-layer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lilmeaty/text-gen-example-one-layer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lilmeaty/text-gen-example-one-layer with Docker Model Runner:
docker model run hf.co/lilmeaty/text-gen-example-one-layer
Modelo Ajustado para Generaci贸n de Texto
Este modelo ha sido ajustado a partir de gpt2 con la siguiente configuraci贸n:
- N煤mero de capas ocultas: 1
- Tama帽o de la capa oculta: 2
- Tama帽o del vocabulario: 50259
Importante: Este modelo utiliza la arquitectura base de gpt2 y ha reducido su tama帽o. El modelo original ten铆a 12 capas, y ahora tiene solo 1 capa oculta. Adem谩s, la dimensi贸n de los embeddings y las capas internas se ha ajustado a 2. Se han a帽adido nuevos tokens al vocabulario y sus embeddings han sido inicializados.
Se puede utilizar para tareas de generaci贸n de texto.
Uso
Para usar este modelo, primero debes tener instalada la librer铆a transformers. Puedes instalarla usando pip:
pip install transformers
Una vez instalada, puedes cargar y usar el modelo de la siguiente manera:
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_name = "lilmeaty/text-gen-example-one-layer"
model = AutoModelForCausalLM.from_pretrained(repo_name)
tokenizer = AutoTokenizer.from_pretrained(repo_name)
prompt = "Escribe una breve historia sobre un robot que aprende a amar."
input_ids = tokenizer.encode(prompt, return_tensors="pt")
output = model.generate(
input_ids,
max_length=100,
num_return_sequences=1,
no_repeat_ngram_size=2,
top_k=50,
top_p=0.95,
temperature=0.7,
do_sample=True
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
- Downloads last month
- 2