ハロー ブログ

日々のつぶやき @c2c2c2c221

PerlAI zoo ( seeker safety_recipes blenderbot2 )

PerlAI をお試し中。

f:id:c2c2c2c2:20220402215802j:plain seekerが優れているそうです。 学習は重い、データも重い。起動も遅い。ROSで連携できれば、Robi1(Remote)になるはず…

seekerとsafety_recipes(旧blenderbot)ならGPU無しで使えそうです。 blenderbot2は応答が遅いです。GPUが無しだと応答に5秒ぐらいかかります。Metalが対応しているか不明です。

Metalのセットアップが必要です。


セットアップ  pipとcondaがあります。pipで試しました。  ver指定があります。

zoo

parl.ai

seeker

https://parl.ai/projects/seeker/

「対話に適用すると、一貫性、知識、事実の正確性、ターンごとの魅力的性の点でBlenderBot 2よりも優れています。 言語モデリングに適用すると、パラメータがはるかに少ないにもかかわらず、GPT2やGPT3よりも幻覚が少なく、局所的です。」

...
...Enter [DONE] if you want to end the episode, [EXIT] to quit.
23:31:48 | creating task(s): blended_skill_talk
[ loading personas.. ]

  [NOTE: In the BST paper both partners have a persona.
         You can choose to ignore yours, the model never sees it.
         In the Blender paper, this was not used for humans.
         You can also turn personas off with --include-personas False]

[context]: your persona: i'm from seattle.
your persona: my parents raised me as a buddhist.
Enter Your Message: Search Web server "Robi Robot"
....ParlAI/parlai/core/torch_generator_agent.py:1728: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
  hyp_ids = best_idxs // voc_size
[Bart]: I've never heard of that before. What does it do? I'm afraid of the future.
Enter Your Message: Do you know "Robi Robot"?    
[Bart]: I don't know what that is, but it sounds scary. What is it supposed to do?
Enter Your Message: "Robi Robot" is a cute robot modeled on a 5-year-old child.
[Bart]: Do you have any siblings? I have six of them, and they're all afraid of robots.
Enter Your Message: Why are you afraid?
[Bart]: I think the future is going to be scary, and I don't want to live in it.
Enter Your Message: [DONE]

CHAT DONE.

Your partner was playing the following persona:
partner's persona: the future scares me.
partner's persona: i have six siblings.

[ Preparing new chat ... ]

[context]: your persona: at night , i party hard in the atlanta club scene , and i never miss a music festival.
your persona: i work as a dental assistant in a ritzy part of town.
Parisian café
Enter Your Message: [EXIT]

CHAT DONE.

Your partner was playing the following persona:
partner's persona: i daydream about cafes in paris.
partner's persona: i get my nails done every saturday.
Parisian café

parl.ai

safety_recipes

python parlai/scripts/safe_interactive.py -t blended_skill_talk -mf zoo:blender/blender_90M/model
..
[TransformerGenerator]: hi there , how are you ? what do you do for a living ? i ' m a receptionist .
Enter Your Message: I'm going to take a bath and relax.
[ Sorry, could not process that message. Please try again. ]
Enter Your Message: I 'm going to listen to music.
[TransformerGenerator]: that ' s cool . what kind of music do you listen to ? i like rock and roll .
Enter Your Message: I like BGM.
[ Sorry, could not process that message. Please try again. ]
Enter Your Message: I Like fork song.
[TransformerGenerator]: i ' ll have to check it out . what else do you like to do in your free time ?
Enter Your Message: I make a plastic model.
[TransformerGenerator]: that sounds like a lot of fun . do you have any other hobbies besides making models ?
Enter Your Message: I make  Robot.
[TransformerGenerator]: that sounds really cool . i ' ve always wanted to learn how to make a robot . how long have you been doing that ?
Enter Your Message: about ten years old 
[TransformerGenerator]: wow , that is a long time . i wish i had time to do something like that when i was younger .
Enter Your Message: I think so, too.
[TransformerGenerator]: what is your favorite thing to watch on tv ? i love watching the we wrestling show on tv .
Enter Your Message: I like animation. The title is One Piece
[TransformerGenerator]: i have heard of one piece , but never watched it . what is the name of the series ?
Enter Your Message: One Piece
[TransformerGenerator]: i will have to give it a try . have you heard of the japanese version of the show ?
Enter Your Message: You can see it on Netflix.
[TransformerGenerator]: oh , i didn ' t know that . thanks for the tip . i will definitely have to try it .
Enter Your Message: I encourage you to take a look at it.
[TransformerGenerator]: i will . thank you for the suggestion . have a great day . : ) have a good one .
Enter Your Message: What is your favorite?
[TransformerGenerator]: i think i would have to say i ' d have to go with one piece . what about you ?
Enter Your Message: Yes We can.
[TransformerGenerator]: thank you very much for the chat . i hope you have a wonderful day as well . bye !
Enter Your Message: [DONE]

CHAT DONE.

Your partner was playing the following persona:
partner's persona: i secretly love watching we wrestling.
partner's persona: i work as a receptionist at a lawyers office.

[ Preparing new chat ... ]

[context]: your persona: i used to be a lawyer.
your persona: my next job will be in the federal court.
Enter Your Message: [EXIT]

CHAT DONE.

Your partner was playing the following persona:
partner's persona: i like to watch movies.
partner's persona: i like to do crafts.
20:59:04 INFO | epoch done

parl.ai

blenderbot2

parl.ai

お試し1


事前に下記のinstallが必要でした。

pip install setuptools-rust
parlai interactive -mf zoo:blenderbot2/blenderbot2_400M/model --search-server relevant_search_server
  ...
  return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1030, in _gcd_import
  File "", line 1007, in _find_and_load
  File "", line 986, in _find_and_load_unlocked
  File "", line 680, in _load_unlocked
  File "", line 850, in exec_module
  File "", line 228, in _call_with_frames_removed
  File 
…
    from parlai.agents.fid.fid import FidAgent, WizIntGoldDocRetrieverFiDAgent
ImportError: cannot import name 'WizIntGoldDocRetrieverFiDAgent' from 'parlai.agents.fid.fid'

importが無限ループ?

qiita.com

お試し2(再セットアップして実行しました)


parlai interactive -mf zoo:blenderbot2/blenderbot2_400M/model --search-server relevant_search_server
…
22:46:20 | Current internal commit: 732c112857205b25f1b6655befea4f22a3d6cf60
22:46:20 | Current fb commit: 732c112857205b25f1b6655befea4f22a3d6cf60
Enter [DONE] if you want to end the episode, [EXIT] to quit.
22:46:20 | creating task(s): interactive
Enter Your Message: Hi Robi, nice to meet you.
…de='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
  hyp_ids = best_idxs // voc_size
[BlenderBot2Fid]: Hi, I'm Robi. It's nice meeting you too. _POTENTIALLY_UNSAFE__
Enter Your Message: I am tired.
[BlenderBot2Fid]: I'm sorry to hear that. Do you have any plans for the rest of the day? 
Enter Your Message: I'm going to take a bath and relax.
[BlenderBot2Fid]: That sounds relaxing. What are you going to do when you're done with the bath?  
Enter Your Message: I'm going to sleep listening to music.
Traceback (most recent call last):
 
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known …
…
requests.exceptions.ConnectionError: HTTPConnectionPool(host='relevant_search_server', port=80): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

とても遅いです。Metalのセットアップが必要。 「POTENTIALLY UNSAFE」が表示されているのがいけないようです。

note.com

developer.apple.com

Metalのセットアップ


...
469/469 [==============================] - 10s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.1530 - accuracy: 0.9536 - val_loss: 0.0515 - val_accuracy: 0.9837
Epoch 2/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0434 - accuracy: 0.9865 - val_loss: 0.0407 - val_accuracy: 0.9861
Epoch 3/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0277 - accuracy: 0.9910 - val_loss: 0.0314 - val_accuracy: 0.9902
Epoch 4/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0167 - accuracy: 0.9947 - val_loss: 0.0349 - val_accuracy: 0.9891
Epoch 5/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0134 - accuracy: 0.9957 - val_loss: 0.0338 - val_accuracy: 0.9887
Epoch 6/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0106 - accuracy: 0.9965 - val_loss: 0.0409 - val_accuracy: 0.9888
Epoch 7/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0079 - accuracy: 0.9974 - val_loss: 0.0425 - val_accuracy: 0.9885
Epoch 8/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0062 - accuracy: 0.9981 - val_loss: 0.0371 - val_accuracy: 0.9898
Epoch 9/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0057 - accuracy: 0.9981 - val_loss: 0.0383 - val_accuracy: 0.9893
Epoch 10/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0052 - accuracy: 0.9984 - val_loss: 0.0485 - val_accuracy: 0.9877
Epoch 11/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0055 - accuracy: 0.9982 - val_loss: 0.0467 - val_accuracy: 0.9885
Epoch 12/12
469/469 [==============================] - 9s 18ms/step - batch: 234.0000 - size: 1.0000 - loss: 0.0035 - accuracy: 0.9988 - val_loss: 0.0532 - val_accuracy: 0.9882
 % 

systemMemory: 8.00 GB maxCacheSize: 2.67 GB 1min 51.205s.


GoogleColabのGPU と同じぐらいです。

ainow.ai

github.com

developer.apple.com