Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ model_name = "rinna/japanese-gpt2-medium"
|
|
6 |
|
7 |
# トークナイザーとパイプラインの設定
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
-
generator = pipeline('text-generation', model=model_name, tokenizer=tokenizer, device
|
10 |
|
11 |
def generate_text(prompt, max_length):
|
12 |
result = generator(prompt, max_length=max_length, num_return_sequences=1)
|
|
|
6 |
|
7 |
# トークナイザーとパイプラインの設定
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
+
generator = pipeline('text-generation', model=model_name, tokenizer=tokenizer, device=-1) # device=0はGPUを使用する設定
|
10 |
|
11 |
def generate_text(prompt, max_length):
|
12 |
result = generator(prompt, max_length=max_length, num_return_sequences=1)
|